mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-28 18:04:44 +00:00
eventcatcher widget: Add viewport-relative coordinates
This is useful because we get viewport relative coordinates from the link and action-navigate widgets
This commit is contained in:
parent
97dff042f7
commit
e9613d7f12
@ -86,6 +86,10 @@ EventWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
catcherNodeRect = self.domNode.getBoundingClientRect();
|
catcherNodeRect = self.domNode.getBoundingClientRect();
|
||||||
variables["event-fromcatcher-posx"] = (event.clientX - catcherNodeRect.left).toString();
|
variables["event-fromcatcher-posx"] = (event.clientX - catcherNodeRect.left).toString();
|
||||||
variables["event-fromcatcher-posy"] = (event.clientY - catcherNodeRect.top).toString();
|
variables["event-fromcatcher-posy"] = (event.clientY - catcherNodeRect.top).toString();
|
||||||
|
|
||||||
|
//Add variables for event X and Y position relative to the viewport
|
||||||
|
variables["event-fromviewport-posx"] = event.clientX.toString();
|
||||||
|
variables["event-fromviewport-posy"] = event.clientY.toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
created: 20201123113532200
|
created: 20201123113532200
|
||||||
modified: 20210711165425543
|
modified: 20210805083352068
|
||||||
tags: Widgets
|
tags: Widgets
|
||||||
title: EventCatcherWidget
|
title: EventCatcherWidget
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -55,6 +55,8 @@ The following variables are made available to the actions:
|
|||||||
|`event-fromselected-posy` |`y` position of the event relative to the selected DOM node |
|
|`event-fromselected-posy` |`y` position of the event relative to the selected DOM node |
|
||||||
|`event-fromcatcher-posx` |`x` position of the event relative to the event catcher DOM node |
|
|`event-fromcatcher-posx` |`x` position of the event relative to the event catcher DOM node |
|
||||||
|`event-fromcatcher-posy` |`y` position of the event relative to the event catcher DOM node |
|
|`event-fromcatcher-posy` |`y` position of the event relative to the event catcher DOM node |
|
||||||
|
|`event-fromviewport-posx` |<<.from-version "5.2.0">> `x` position of the event relative to the viewport |
|
||||||
|
|`event-fromviewport-posy` |<<.from-version "5.2.0">> `y` position of the event relative to the viewport |
|
||||||
|
|
||||||
! Example
|
! Example
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user