modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSceneDnDEventHandler.java
Print this page
@@ -44,16 +44,27 @@
this.scene = scene;
}
// Drop target handlers
- private double getPlatformScale() {
+ private double getPlatformScaleX() {
View view = scene.getPlatformView();
if (view != null) {
Window w = view.getWindow();
if (w != null) {
- return w.getPlatformScale();
+ return w.getPlatformScaleX();
+ }
+ }
+ return 1.0;
+ }
+
+ private double getPlatformScaleY() {
+ View view = scene.getPlatformView();
+ if (view != null) {
+ Window w = view.getWindow();
+ if (w != null) {
+ return w.getPlatformScaleY();
}
}
return 1.0;
}
@@ -62,14 +73,15 @@
final ClipboardAssistance dropTargetAssistant)
{
assert Platform.isFxApplicationThread();
return AccessController.doPrivileged((PrivilegedAction<TransferMode>) () -> {
if (scene.dropTargetListener != null) {
- double pScale = getPlatformScale();
+ double pScaleX = getPlatformScaleX();
+ double pScaleY = getPlatformScaleY();
QuantumClipboard dragboard =
QuantumClipboard.getDragboardInstance(dropTargetAssistant, false);
- return scene.dropTargetListener.dragEnter(x / pScale, y / pScale, xAbs / pScale, yAbs / pScale,
+ return scene.dropTargetListener.dragEnter(x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY,
recommendedTransferMode, dragboard);
}
return null;
}, scene.getAccessControlContext());
}
@@ -89,12 +101,13 @@
final ClipboardAssistance dropTargetAssistant)
{
assert Platform.isFxApplicationThread();
return AccessController.doPrivileged((PrivilegedAction<TransferMode>) () -> {
if (scene.dropTargetListener != null) {
- double pScale = getPlatformScale();
- return scene.dropTargetListener.drop(x / pScale, y / pScale, xAbs / pScale, yAbs / pScale,
+ double pScaleX = getPlatformScaleX();
+ double pScaleY = getPlatformScaleY();
+ return scene.dropTargetListener.drop(x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY,
recommendedTransferMode);
}
return null;
}, scene.getAccessControlContext());
}
@@ -104,12 +117,13 @@
final ClipboardAssistance dropTargetAssistant)
{
assert Platform.isFxApplicationThread();
return AccessController.doPrivileged((PrivilegedAction<TransferMode>) () -> {
if (scene.dropTargetListener != null) {
- double pScale = getPlatformScale();
- return scene.dropTargetListener.dragOver(x / pScale, y / pScale, xAbs / pScale, yAbs / pScale,
+ double pScaleX = getPlatformScaleX();
+ double pScaleY = getPlatformScaleY();
+ return scene.dropTargetListener.dragOver(x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY,
recommendedTransferMode);
}
return null;
}, scene.getAccessControlContext());
}
@@ -124,15 +138,16 @@
final ClipboardAssistance dragSourceAssistant)
{
assert Platform.isFxApplicationThread();
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
if (scene.dragGestureListener != null) {
- double pScale = getPlatformScale();
+ double pScaleX = getPlatformScaleX();
+ double pScaleY = getPlatformScaleY();
QuantumClipboard dragboard =
QuantumClipboard.getDragboardInstance(dragSourceAssistant, true);
scene.dragGestureListener.dragGestureRecognized(
- x / pScale, y / pScale, xAbs / pScale, yAbs / pScale, button, dragboard);
+ x / pScaleX, y / pScaleY, xAbs / pScaleX, yAbs / pScaleY, button, dragboard);
}
return null;
}, scene.getAccessControlContext());
}