1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Fix typo in navigate handler for button widget

This commit is contained in:
Jermolene 2014-03-08 10:22:09 +00:00
parent a5a2c718b1
commit 81af6bdd48

View File

@ -54,7 +54,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
domNode.addEventListener("click",function (event) {
var handled = false;
if(self.to) {
self.dispatchEvent({type: "tw-navigate", navigateTo: self.to, tiddlerTitle: self.getVariable("currentTiddler")});
self.navigateTo(event);
handled = true;
}
if(self.message) {
@ -92,6 +92,19 @@ ButtonWidget.prototype.isPoppedUp = function() {
return result;
};
ButtonWidget.prototype.navigateTo = function(event) {
var bounds = this.domNodes[0].getBoundingClientRect();
this.dispatchEvent({
type: "tw-navigate",
navigateTo: this.to,
navigateFromTitle: this.getVariable("storyTiddler"),
navigateFromNode: this,
navigateFromClientRect: { top: bounds.top, left: bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: bounds.height
},
navigateSuppressNavigation: event.metaKey || event.ctrlKey || (event.button === 1)
});
};
ButtonWidget.prototype.dispatchMessage = function(event) {
this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler")});
};