Skip to content

Commit

Permalink
Removes autoscaleup in Java2D Displays
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Mar 20, 2022
1 parent 1929e68 commit aa94633
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
Expand Up @@ -10,19 +10,6 @@
********************************************************************************************************/
package ummisco.gama.java2d;

/*********************************************************************************************
*
*
* 'AbstractAWTDisplaySurface.java', in plugin 'msi.gama.application', is part of the source code of the GAMA modeling
* and simulation platform. (v. 1.8.1)
*
* (c) 2007-2020 UMI 209 UMMISCO IRD/UPMC & Partners
*
* Visit https://github.com/gama-platform/gama for license information and developers contact.
*
*
**********************************************************************************************/

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
Expand Down Expand Up @@ -204,22 +191,10 @@ public void dispatchKeyEvent(final char e) {
for (final IEventLayerListener gl : listeners) { gl.keyPressed(String.valueOf(e)); }
}

/**
* Auto scale up.
*
* @param c
* the c
* @return the int
*/
int autoScaleUp(final int c) {
if (DPIHelper.getDeviceZoom() > 100) return c;
return DPIHelper.autoScaleUp(c);
}

@Override
public void setMousePosition(final int xm, final int ym) {
final int x = autoScaleUp(xm);
final int y = autoScaleUp(ym);
final int x = xm;
final int y = ym;
if (mousePosition == null) {
mousePosition = new Point(x, y);
} else {
Expand All @@ -230,7 +205,7 @@ public void setMousePosition(final int xm, final int ym) {
@Override
public void draggedTo(final int x, final int y) {
final Point origin = getOrigin();
setOrigin(origin.x + autoScaleUp(x) - getMousePosition().x, origin.y + autoScaleUp(y) - getMousePosition().y);
setOrigin(origin.x + x - getMousePosition().x, origin.y + y - getMousePosition().y);
setMousePosition(x, y);
updateDisplay(true);
}
Expand Down
Expand Up @@ -34,7 +34,6 @@
import msi.gama.application.workbench.PerspectiveHelper;
import msi.gama.common.interfaces.IGamaView;
import msi.gama.common.preferences.GamaPreferences;
import msi.gama.runtime.PlatformHelper;
import msi.gama.util.tree.GamaNode;
import msi.gama.util.tree.GamaTree;
import one.util.streamex.StreamEx;
Expand Down Expand Up @@ -156,13 +155,11 @@ public static void execute(final GamaTree<String> tree) {
*/
private static void activateDisplays(final List<MPlaceholder> holders, final boolean focus) {
holders.forEach(ph -> {
//
try {
getPartService().bringToTop((MPart) ph.getRef());
// Necessary as otherwise the Java2D display does not show up if it is alone
getPartService().bringToTop((MPart) ph.getRef());
getPartService().activate((MPart) ph.getRef(), focus);
} catch (IllegalStateException e) {}

// ((MPart) ph.getRef()).setOnTop(true);
});
}

Expand Down

0 comments on commit aa94633

Please sign in to comment.