简体   繁体   English

更新 draw2d UI 以匹配选择

[英]Update draw2d UI to match Selection

My page has in its center a Draw2D canvas.我的页面在其中心有一个 Draw2D 画布。 It may have a selection or not at any moment.它可能随时有选择或没有选择。

I need to update the selection manually .我需要手动更新选择 When the user (drags and) drops an element from the Toolbox (panel on the left of the page), it creates the element in the canvas.当用户(拖放)从工具箱(页面左侧的面板)中放置一个元素时,它会在画布中创建该元素。 I want this element to be selected.我想选择这个元素。 To do so, I made this:为此,我做了这个:

canvas.getSelection().clear().setPrimary(newFigure);

Triggers are attached to selection change.触发器附加到选择更改。 On the right side of the page, I have a Properties panel that shows information on what is selected.在页面的右侧,我有一个“属性”面板,显示有关所选内容的信息。

When I drop my element, my UI updates so that the Properties panel's content to match the Figure that was just added.当我放下元素时,我的 UI 会更新,以便“属性”面板的内容与刚刚添加的图相匹配。 But the fact is that the blue dashed rectangle that is supposed to be around the selected element(s) is not updated.但事实是,应该围绕所选元素的蓝色虚线矩形没有更新。 Consequence is that the user might be confused (imagine yourself seeing details on Foo when Bar is selected).结果是,用户可能会混淆(想象自己在选择Bar时看到Foo细节)。

In this case, why isn't the visual selection updated ?在这种情况下,为什么视觉选择没有更新 And how to do so , if it is possible?如果可能的话,怎么做

Canvas 有一个 setCurrentSelection 方法,它接受任何 draw2d.Figure 或 draw2d.util.ArrayList 的图形

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

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