1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Add tv-widgetnode-width and tv-widgetnode-height (#6681)

* Add tv-widgetnode-width and tv-widgetnode-height to collectDOMVariables

* Add docs

* update docs

* Update modified field
This commit is contained in:
Simon Huber 2022-05-09 11:42:23 +02:00 committed by GitHub
parent 4b8594c4a8
commit b4deb7cc45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -304,6 +304,11 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString(); variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
} }
} }
if(domNode && domNode.offsetWidth) {
variables["tv-widgetnode-width"] = domNode.offsetWidth.toString();
variables["tv-widgetnode-height"] = domNode.offsetHeight.toString();
}
if(event && event.clientX && event.clientY) { if(event && event.clientX && event.clientY) {
if(selectedNode) { if(selectedNode) {

View File

@ -1,5 +1,5 @@
created: 20201123113532200 created: 20201123113532200
modified: 20220311154749139 modified: 20220507184043398
tags: Widgets TriggeringWidgets tags: Widgets TriggeringWidgets
title: EventCatcherWidget title: EventCatcherWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -48,6 +48,8 @@ The following variables are made available to the actions:
|`event-type` |The type property of the JavaScript event | |`event-type` |The type property of the JavaScript event |
|`event-detail-*` |Any properties in the detail attribute of the event are made available with the prefix `event-detail-` | |`event-detail-*` |Any properties in the detail attribute of the event are made available with the prefix `event-detail-` |
|`tv-popup-coords` |A co-ordinate string that can be used with the ActionPopupWidget to trigger a popup at the DOM node matching the selector where the event originated | |`tv-popup-coords` |A co-ordinate string that can be used with the ActionPopupWidget to trigger a popup at the DOM node matching the selector where the event originated |
|`tv-widgetnode-width` |<<.from-version "5.2.3">> `offsetWidth` of the DOM node created by the eventcatcher widget |
|`tv-widgetnode-height` |<<.from-version "5.2.3">> `offsetHeight` of the DOM node created by the eventcatcher widget |
|`tv-selectednode-posx` |`x` offset position of the selected DOM node | |`tv-selectednode-posx` |`x` offset position of the selected DOM node |
|`tv-selectednode-posy` |`y` offset position of the selected DOM node | |`tv-selectednode-posy` |`y` offset position of the selected DOM node |
|`tv-selectednode-width` |`offsetWidth` of the selected DOM node | |`tv-selectednode-width` |`offsetWidth` of the selected DOM node |