aboutsummaryrefslogtreecommitdiff
path: root/plugins/draganddropselectedtext.lua
diff options
context:
space:
mode:
authorSwissalpS <Luke@SwissalpS.ws>2020-06-26 12:46:51 +0200
committerSwissalpS <Luke@SwissalpS.ws>2020-06-26 12:46:51 +0200
commitb9c23388fec9cb847c3c21f0edbf6257decf93d4 (patch)
treecab924830507523c17b3d7979a344e4dcc9eda19 /plugins/draganddropselectedtext.lua
parent452c77f05321cdf73294d164d4ba9c7e06292aa4 (diff)
downloadlite-xl-plugins-b9c23388fec9cb847c3c21f0edbf6257decf93d4.tar.gz
lite-xl-plugins-b9c23388fec9cb847c3c21f0edbf6257decf93d4.zip
update mouse cursor to hand when dragging
Diffstat (limited to 'plugins/draganddropselectedtext.lua')
-rw-r--r--plugins/draganddropselectedtext.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/draganddropselectedtext.lua b/plugins/draganddropselectedtext.lua
index d27169d..d5f0d04 100644
--- a/plugins/draganddropselectedtext.lua
+++ b/plugins/draganddropselectedtext.lua
@@ -31,9 +31,14 @@ end -- isInSelection
local on_mouse_moved = DocView.on_mouse_moved
function DocView:on_mouse_moved(x, y, ...)
+ local sCursor = nil
+
-- make sure we only act if previously on_mouse_pressed was in selection
if self.bClickedIntoSelection then
+ -- show that we are dragging something
+ sCursor = 'hand'
+
-- check for modifier to duplicate
-- (may want to set a flag as this only needs to be done once)
-- TODO: make image to drag with and/or hand over to OS dnd event
@@ -42,8 +47,9 @@ function DocView:on_mouse_moved(x, y, ...)
-- as some editors do, only when dropped. I do like it going
-- instantly as that reduces the travel-distance.
self.doc:delete_to(0)
- --self.cursor = 'arrowWithPlus'
+ --sCursor = 'arrowWithPlus' -- 'handWithPlus'
end
+
-- calculate line and column for current mouse position
local iLine, iCol = self:resolve_screen_position(x, y)
-- move text cursor
@@ -54,7 +60,9 @@ function DocView:on_mouse_moved(x, y, ...)
end -- if previously clicked into selection
-- hand off to 'old' on_mouse_moved()
- return on_mouse_moved(self, x, y, ...)
+ on_mouse_moved(self, x, y, ...)
+ -- override cursor as needed
+ if sCursor then self.cursor = sCursor end
end -- DocView:on_mouse_moved