Improve obtaining initial player dragging coords

This commit is contained in:
Rafostar
2020-11-06 20:33:14 +01:00
parent 868c39f1cf
commit 9be93c66f1

View File

@@ -560,15 +560,24 @@ class ClapperPlayer extends PlayerBase
let [isActive, startX, startY] = gesture.get_start_point(); let [isActive, startX, startY] = gesture.get_start_point();
if(!isActive) return; if(!isActive) return;
let root = this.widget.get_root(); let native = this.widget.get_native();
if(!root) return; if(!native) return;
let [isShared, winX, winY] = this.widget.translate_coordinates(
native, startX, startY
);
if(!isShared) return;
let [nativeX, nativeY] = native.get_surface_transform();
winX += nativeX;
winY += nativeY;
this.isWidgetDragging = true; this.isWidgetDragging = true;
root.get_surface().begin_move( native.get_surface().begin_move(
gesture.get_device(), gesture.get_device(),
gesture.get_current_button(), gesture.get_current_button(),
startX, winX,
startY, winY,
gesture.get_current_event_time() gesture.get_current_event_time()
); );