Skip to content

Commit e452ea9

Browse files
(v2) Scene editor: better selection rendering.
1 parent dfe6484 commit e452ea9

File tree

1 file changed

+17
-5
lines changed
  • source/v2/phasereditor/phasereditor.scene.ui/src/phasereditor/scene/ui/editor

1 file changed

+17
-5
lines changed

source/v2/phasereditor/phasereditor.scene.ui/src/phasereditor/scene/ui/editor/SceneCanvas.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import phasereditor.scene.core.TextureComponent;
6868
import phasereditor.scene.core.TransformComponent;
6969
import phasereditor.scene.ui.editor.undo.WorldSnapshotOperation;
70+
import phasereditor.ui.ColorUtil;
7071
import phasereditor.ui.ZoomCanvas;
7172

7273
/**
@@ -102,7 +103,7 @@ public SceneCanvas(Composite parent, int style) {
102103
addMouseMoveListener(this);
103104

104105
init_DND();
105-
106+
106107
setZoomWhenShiftPressed(false);
107108
}
108109

@@ -280,6 +281,9 @@ private void renderBorders(GC gc, ZoomCalculator calc) {
280281
}
281282

282283
private void renderSelection(GC gc) {
284+
285+
var selectionColor = SWTResourceManager.getColor(ColorUtil.GREENYELLOW.rgb);
286+
283287
for (var obj : _selection) {
284288
if (obj instanceof ObjectModel) {
285289
var model = (ObjectModel) obj;
@@ -294,19 +298,27 @@ private void renderSelection(GC gc) {
294298

295299
var merge = SceneObjectRenderer.joinBounds(bounds, childrenBounds);
296300

297-
gc.setAlpha(150);
298-
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_GREEN));
301+
gc.setForeground(selectionColor);
299302

300303
gc.drawPolygon(new int[] { (int) merge[0], (int) merge[1], (int) merge[2], (int) merge[3],
301304
(int) merge[4], (int) merge[5], (int) merge[6], (int) merge[7] });
302-
gc.setAlpha(255);
303305
}
304306

305307
}
306308
}
307309

308310
if (bounds != null) {
309-
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
311+
gc.setLineWidth(3);
312+
gc.setAlpha(150);
313+
gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
314+
315+
gc.drawPolygon(new int[] { (int) bounds[0], (int) bounds[1], (int) bounds[2], (int) bounds[3],
316+
(int) bounds[4], (int) bounds[5], (int) bounds[6], (int) bounds[7] });
317+
318+
gc.setAlpha(255);
319+
gc.setLineWidth(1);
320+
321+
gc.setForeground(selectionColor);
310322
gc.drawPolygon(new int[] { (int) bounds[0], (int) bounds[1], (int) bounds[2], (int) bounds[3],
311323
(int) bounds[4], (int) bounds[5], (int) bounds[6], (int) bounds[7] });
312324
}

0 commit comments

Comments
 (0)