mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-28 15:08:46 +00:00
Fix eventcatcher to ensure variable values are strings
I was getting some inconsistencies with filter operators that expect strings.
This commit is contained in:
parent
e3bf1f43cf
commit
2267e31546
@ -58,26 +58,26 @@ EventWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
// If we found one, copy the attributes as variables, otherwise exit
|
// If we found one, copy the attributes as variables, otherwise exit
|
||||||
if(selectedNode.matches(selector)) {
|
if(selectedNode.matches(selector)) {
|
||||||
$tw.utils.each(selectedNode.attributes,function(attribute) {
|
$tw.utils.each(selectedNode.attributes,function(attribute) {
|
||||||
variables["dom-" + attribute.name] = attribute.value;
|
variables["dom-" + attribute.name] = attribute.value.toString();
|
||||||
});
|
});
|
||||||
//Add a variable with a popup coordinate string for the selected node
|
//Add a variable with a popup coordinate string for the selected node
|
||||||
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
|
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
|
||||||
|
|
||||||
//Add variables for offset of selected node
|
//Add variables for offset of selected node
|
||||||
variables["tv-selectednode-posx"] = selectedNode.offsetLeft;
|
variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString();
|
||||||
variables["tv-selectednode-posy"] = selectedNode.offsetTop;
|
variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString();
|
||||||
variables["tv-selectednode-width"] = selectedNode.offsetWidth;
|
variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString();
|
||||||
variables["tv-selectednode-height"] = selectedNode.offsetHeight;
|
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
|
||||||
|
|
||||||
//Add variables for event X and Y position relative to selected node
|
//Add variables for event X and Y position relative to selected node
|
||||||
selectedNodeRect = selectedNode.getBoundingClientRect();
|
selectedNodeRect = selectedNode.getBoundingClientRect();
|
||||||
variables["event-fromselected-posx"] = event.clientX - selectedNodeRect.left;
|
variables["event-fromselected-posx"] = (event.clientX - selectedNodeRect.left).toString();
|
||||||
variables["event-fromselected-posy"] = event.clientY - selectedNodeRect.top;
|
variables["event-fromselected-posy"] = (event.clientY - selectedNodeRect.top).toString();
|
||||||
|
|
||||||
//Add variables for event X and Y position relative to event catcher node
|
//Add variables for event X and Y position relative to event catcher node
|
||||||
catcherNodeRect = self.domNode.getBoundingClientRect();
|
catcherNodeRect = self.domNode.getBoundingClientRect();
|
||||||
variables["event-fromcatcher-posx"] = event.clientX - catcherNodeRect.left;
|
variables["event-fromcatcher-posx"] = (event.clientX - catcherNodeRect.left).toString();
|
||||||
variables["event-fromcatcher-posy"] = event.clientY - catcherNodeRect.top;
|
variables["event-fromcatcher-posy"] = (event.clientY - catcherNodeRect.top).toString();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user