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

Commit

Permalink
Fix some mouse positioning issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Craga89 committed Apr 15, 2013
1 parent 7ca6ee3 commit 1ce2aa7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/core/events.js
Expand Up @@ -175,8 +175,6 @@ PROTOTYPE._assignEvents = function() {
this._bind(hideTarget.add(tooltip), QTIP.inactiveEvents, inactiveMethod, '-inactive');
}

this.id === 'unfocus' && console.log(showEvents, hideEvents, toggleEvents);

// Apply hide events (and filter identical show events)
hideEvents = $.map(hideEvents, function(type) {
var showIndex = $.inArray(type, showEvents);
Expand All @@ -189,7 +187,6 @@ PROTOTYPE._assignEvents = function() {
return type;
});


// Apply show/hide/toggle events
this._bind(showTarget, showEvents, showMethod);
this._bind(hideTarget, hideEvents, hideMethod);
Expand All @@ -214,17 +211,17 @@ PROTOTYPE._assignEvents = function() {
// Mouse positioning events
if(posOptions.target === 'mouse') {
// Cache mousemove coords on show targets
this._bind(showTarget, 'mousemove', this._storeMouse);
this._bind(showTarget.add(tooltip), 'mousemove', this._storeMouse);

// Hide when we leave the tooltip and not onto the show target
options.hide.event && this._bind(tooltip, 'mouseleave', function(event) {
!$(event.relatedTarget || event.target).closest(showTarget[0]).length && this.hide(event);
});

// If mouse adjustment is on...
if(posOptions.adjust.mouse) {
// Apply a mouseleave event so we don't get problems with overlapping
if(options.hide.event) {
// Hide when we leave the tooltip and not onto the show target
this._bind(tooltip, 'mouseleave', function(event) {
(event.relatedTarget || event.target) !== showTarget[0] && this.hide(event);
});

// Track if we're on the target or not
this._bind(showTarget, ['mouseenter', 'mouseleave'], function(event) {
this.cache.onTarget = event.type === 'mouseenter';
Expand Down

0 comments on commit 1ce2aa7

Please sign in to comment.