Skip to content

Commit

Permalink
feat(context-pad): support mouseover and mouseout
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Aug 4, 2023
1 parent b6a2f3a commit 82a8a3d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/features/context-pad/ContextPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,19 @@ ContextPad.prototype.trigger = function(action, event, autoActivate) {
entry = domAttr(button, 'data-action');
originalEvent = event.originalEvent || event;

if (action === 'mouseover') {
this._mouseout = this.triggerEntry(entry, 'hover', originalEvent, autoActivate);
} else if (action === 'mouseout' && this._mouseout) {
this._mouseout();

this._mouseout = null;
}

return this.triggerEntry(entry, action, originalEvent, autoActivate);
};

/**
* Trigger context pad entry entry.
* Trigger action on context pad entry entry, e.g. click, mouseover or mouseout.
*
* @param {string} entryId
* @param {string} action
Expand Down Expand Up @@ -391,6 +399,14 @@ ContextPad.prototype.getPad = function(target) {
self.trigger('dragstart', event);
});

domDelegate.bind(html, entrySelector, 'mouseover', function(event) {
self.trigger('mouseover', event);
});

domDelegate.bind(html, entrySelector, 'mouseout', function(event) {
self.trigger('mouseout', event);
});

// stop propagation of mouse events
domEvent.bind(html, 'mousedown', function(event) {
event.stopPropagation();
Expand Down

0 comments on commit 82a8a3d

Please sign in to comment.