1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Unpack the object returned by getBoundingClientRect()

Embedding the return object directly doesn't survive the object being
passed as an event parameter.

Fixes #114
This commit is contained in:
Jeremy Ruston 2013-07-25 16:58:42 +01:00
parent a79e876806
commit 602b9d34e4

View File

@ -95,10 +95,18 @@ LinkWidget.prototype.handleClickEvent = function(event) {
event.target.setAttribute("target","_blank");
return true;
} else {
var bounds = this.renderer.domNode.getBoundingClientRect();
$tw.utils.dispatchCustomEvent(event.target,"tw-navigate",{
navigateTo: this.to,
navigateFromNode: this,
navigateFromClientRect: this.renderer.domNode.getBoundingClientRect()
navigateFromClientRect: {
top: bounds.top,
left: bounds.left,
width: bounds.width,
right: bounds.right,
bottom: bounds.bottom,
height: bounds.height
}
});
event.preventDefault();
event.stopPropagation();