Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
Fix positioning binding
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed May 21, 2013
1 parent 273f3d8 commit b14a748
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/core/events.js
Expand Up @@ -228,9 +228,11 @@ PROTOTYPE._assignEvents = function() {
(this.tooltip[0].offsetWidth > 0 ? hideMethod : showMethod).call(this, event);
});

// Check if the tooltip hides when mouse is moved a certain distance
if('number' === typeof options.hide.distance) {
this._bind(showTarget.add(tooltip), 'mousemove', function(event) {

// Mouse movement bindings
this._bind(showTarget.add(tooltip), 'mousemove', function(event) {
// Check if the tooltip hides when mouse is moved a certain distance
if('number' === typeof options.hide.distance) {
var origin = this.cache.origin || {},
limit = this.options.hide.distance,
abs = Math.abs;
Expand All @@ -239,11 +241,11 @@ PROTOTYPE._assignEvents = function() {
if(abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit) {
this.hide(event);
}
}

// Cache mousemove coords on show targets
this._storeMouse(event);
});
}
// Cache mousemove coords on show targets
this._storeMouse(event);
});

// Mouse positioning events
if(posOptions.target === 'mouse') {
Expand All @@ -261,7 +263,7 @@ PROTOTYPE._assignEvents = function() {
this._bind(documentTarget, 'mousemove', function(event) {
// Update the tooltip position only if the tooltip is visible and adjustment is enabled
if(this.rendered && this.cache.onTarget && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0) {
this.reposition(event || this.mouse);
this.reposition(event);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/position.js
Expand Up @@ -39,7 +39,7 @@ PROTOTYPE.reposition = function(event, effect) {
at = { x: LEFT, y: TOP };

// Use cached event if one isn't available for positioning
event = mouse && mouse.pageX && (adjust.mouse || !event || !event.pageX) ? { pageX: mouse.pageX, pageY: mouse.pageY } :
event = mouse && mouse.pageX && (adjust.mouse || !event || !event.pageX) ? mouse :
(event && (event.type === 'resize' || event.type === 'scroll') ? cache.event :
event && event.pageX && event.type === 'mousemove' ? event :
(!adjust.mouse || this.options.show.distance) && cache.origin && cache.origin.pageX ? cache.origin :
Expand Down

0 comments on commit b14a748

Please sign in to comment.