From 9be93c66f173ec793f61d53d763a17b454e60d12 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Fri, 6 Nov 2020 20:33:14 +0100 Subject: [PATCH] Improve obtaining initial player dragging coords --- clapper_src/player.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/clapper_src/player.js b/clapper_src/player.js index 6c76123c..02bdfdc8 100644 --- a/clapper_src/player.js +++ b/clapper_src/player.js @@ -560,15 +560,24 @@ class ClapperPlayer extends PlayerBase let [isActive, startX, startY] = gesture.get_start_point(); if(!isActive) return; - let root = this.widget.get_root(); - if(!root) return; + let native = this.widget.get_native(); + 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; - root.get_surface().begin_move( + native.get_surface().begin_move( gesture.get_device(), gesture.get_current_button(), - startX, - startY, + winX, + winY, gesture.get_current_event_time() );