Skip to content

Commit

Permalink
Adjust mouse hover event names to match other events.
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-pmb committed Jul 15, 2024
1 parent 4346a13 commit 410a54b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/components/anno-viewer/anno-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
(otherVersionsExist() ? 'has' : 'no') + '-other-versions',
(isOwnAnno && 'own-anno'),
].filter(Boolean)"
v-on:mouseover.stop="mouseenter"
v-on:mouseleave.stop="mouseleave"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
:data-w3-anno-id="annoIdUrl"
:data-iana-working-copy="annotation['iana:working-copy']"
:data-target-fragment="targetFragment"
Expand Down
26 changes: 13 additions & 13 deletions src/components/anno-viewer/anno-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const xrxUtilsUtils = require('./xrxUtilsUtils.js');
* - `reply`: A new annotation as a reply to this annotation should be opened in an editor
* - `startHighlighting`: Start highlighting this annotation
* - `stopHighlighting`: Stop highlighting this annotation
* - `mouseenter`: The mouse cursor is now on this annotation
* - `mouseleave`: The mouse cursor has left this annotation
* - `mouseEnter`: The mouse cursor is now on this annotation
* - `mouseLeave`: The mouse cursor has left this annotation
*/

function firstEntryIfArray(x) { return (x && Array.isArray(x) && x[0]); }
Expand Down Expand Up @@ -437,21 +437,21 @@ module.exports = {
return setDoiMsg('mint_doi.success');
},

mouseenter() {
this.startHighlighting();
eventBus.$emit('mouseenter', this.makeEventContext());
onMouseEnter() {
this.startHighlighting();
eventBus.$emit('mouseEnter', this.makeEventContext());
},
mouseleave() {
this.stopHighlighting();
eventBus.$emit('mouseleave', this.makeEventContext());
onMouseLeave() {
this.stopHighlighting();
eventBus.$emit('mouseLeave', this.makeEventContext());
},

startHighlighting(expand) {
this.highlighted = true
if (expand) eventBus.$emit('expand', this.annoIdUrl, true)
startHighlighting(expand) {
this.highlighted = true;
if (expand) { eventBus.$emit('expand', this.annoIdUrl, true); }
},
stopHighlighting() {this.highlighted = false},
toggleHighlighting() {this.highlighted = ! this.highlighted},
stopHighlighting() { this.highlighted = false; },
toggleHighlighting() { this.highlighted = !this.highlighted; },

collapse(command) {
const el = this;
Expand Down
2 changes: 1 addition & 1 deletion src/default-config/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ handlers (event name → function). Currently, these are supported:
Fired after the AnnoApp has been installed into the DOM.
A single argument is passed: The reference to the AnnoApp.

### `mouseover`, `mouseleave`
### `mouseEnter`, `mouseLeave`
Fired when the mouse pointer hovers/unhovers an annotation.
For details, see the anno-viewer component documentation.

Expand Down
4 changes: 2 additions & 2 deletions test/html/tests.fragment-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
window.location.hash = '#' + fragId;
},

mouseenter(ev) {
mouseEnter(ev) {
const fragId = ev.dataApi('findTargetFragment');
setUniqueCssClassByDomId('hovering', fragId);
},
mouseleave() { setUniqueCssClassByDomId('hovering'); },
mouseLeave() { setUniqueCssClassByDomId('hovering'); },

});
}());
Expand Down

0 comments on commit 410a54b

Please sign in to comment.