Skip to content

Commit 1b455b6

Browse files
committed
Implement HighDPI scaling for Zest figures
This continues eclipse-gef#770 and implements HighDPI scaling for Zest graphs. If the corresponding "draw2d.disableAutoscale" system property is set, a ZoomChange listener is added to the Graph that automatically scales the root figure to match the display zoom.
1 parent 1e71720 commit 1b455b6

File tree

1 file changed

+5
-0
lines changed
  • org.eclipse.zest.core/src/org/eclipse/zest/core/widgets

1 file changed

+5
-0
lines changed

org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import org.eclipse.draw2d.geometry.Point;
7575
import org.eclipse.draw2d.geometry.Rectangle;
7676
import org.eclipse.draw2d.internal.FileImageDataProvider;
77+
import org.eclipse.draw2d.internal.InternalDraw2dUtils;
7778

7879
/**
7980
* Holds the nodes and connections for the graph.
@@ -239,6 +240,10 @@ public void dispatchMouseMoved(org.eclipse.swt.events.MouseEvent me) {
239240
this.zoomListener = new ZoomGestureListener();
240241
this.rotateListener = new RotateGestureListener();
241242

243+
if (InternalDraw2dUtils.disableAutoscale) {
244+
this.addListener(SWT.ZoomChanged, event -> this.rootlayer.setScale(event.detail));
245+
}
246+
242247
this.addPaintListener(event -> {
243248
if (shouldSheduleLayout) {
244249
applyLayoutInternal(true);

0 commit comments

Comments
 (0)