简体   繁体   English

是否有任何 Draw2d.js 方法来引入调整大小限制?

[英]Is there any Draw2d.js way to introduce resizing restrictions?

I have a question about Draw2D.js.我有一个关于 Draw2D.js 的问题。 I have to use ONLY rectangular blocks, so I want the user to only be able to alter the length of the rectangle and prohibit the possibility of modifying its width.我只能使用矩形块,所以我希望用户只能更改矩形的长度并禁止修改其宽度的可能性。

In addition, the length should be limited to multiples of a fixed value, indicated by the grid.此外,长度应限制为固定值的倍数,由网格指示。

Draw2d does have WidthSelectionFeedbackPolicy which operates on a Figure - see http://www.draw2d.org/draw2d_touch/jsdoc_6/#./api/draw2d.policy.figure.WidthSelectionFeedbackPolicy Draw2d 确实有 WidthSelectionFeedbackPolicy 对图形进行操作 - 请参阅http://www.draw2d.org/draw2d_touch/jsdoc_6/#./api/draw2d.policy.figure.WidthSelectionFeedbackPolicy

This restricts users to altering the width of a rectangle (ie in the horizontal direction) but they can't alter it in the vertical direction.这限制了用户改变矩形的宽度(即在水平方向上),但他们不能在垂直方向上改变它。

So I suggest you have a look at the source code for that policy and change it to create one which restricts it according to your requirements.因此,我建议您查看该策略的源代码,并将其更改为根据您的要求对其进行限制。 I would expect that using this approach you can restrict the length to multiples, but I can't confirm that.我希望使用这种方法可以将长度限制为倍数,但我无法确认。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM