mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 22:33:50 +00:00
Fix: eventcatcher widget - variables can be undefined (#6668)
* Fix: eventcatcher widget - variables can be undefined * Fix: selectedNode can be an svg where offsetLeft ... are undefined * Make check for offsetLeft short * remove second collectDOMNodeVariables
This commit is contained in:
parent
9b9e443c73
commit
4b8594c4a8
@ -292,14 +292,17 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) {
|
|||||||
$tw.utils.each(selectedNode.attributes,function(attribute) {
|
$tw.utils.each(selectedNode.attributes,function(attribute) {
|
||||||
variables["dom-" + attribute.name] = attribute.value.toString();
|
variables["dom-" + attribute.name] = attribute.value.toString();
|
||||||
});
|
});
|
||||||
// Add a variable with a popup coordinate string for the selected node
|
|
||||||
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
|
|
||||||
|
|
||||||
// Add variables for offset of selected node
|
if(selectedNode.offsetLeft) {
|
||||||
variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString();
|
// Add a variable with a popup coordinate string for the selected node
|
||||||
variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString();
|
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
|
||||||
variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString();
|
|
||||||
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
|
// Add variables for offset of selected node
|
||||||
|
variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString();
|
||||||
|
variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString();
|
||||||
|
variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString();
|
||||||
|
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event && event.clientX && event.clientY) {
|
if(event && event.clientX && event.clientY) {
|
||||||
|
@ -52,7 +52,7 @@ EventWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
selectedNode = event.target,
|
selectedNode = event.target,
|
||||||
selectedNodeRect,
|
selectedNodeRect,
|
||||||
catcherNodeRect,
|
catcherNodeRect,
|
||||||
variables;
|
variables = {};
|
||||||
// Firefox can fire dragover and dragenter events on text nodes instead of their parents
|
// Firefox can fire dragover and dragenter events on text nodes instead of their parents
|
||||||
if(selectedNode.nodeType === 3) {
|
if(selectedNode.nodeType === 3) {
|
||||||
selectedNode = selectedNode.parentNode;
|
selectedNode = selectedNode.parentNode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user