Skip to content

Commit

Permalink
Merge pull request #1784 from xeokit/fix/XV-574
Browse files Browse the repository at this point in the history
Fix/XV-574: markerClicked event is not fired on ios safari
  • Loading branch information
xeolabs authored Jan 22, 2025
2 parents 06a91e0 + b1d4f01 commit e269006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/plugins/AnnotationsPlugin/Annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ class Annotation extends Marker {
addContextMenuListener(this._marker, e => {
e.preventDefault();
this.plugin.fire("contextmenu", this);
}, e => {
e.preventDefault();
this.plugin.fire("markerClicked", this);
})
this._marker.addEventListener("mouseenter", () => {
this.plugin.fire("markerMouseEnter", this);
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/lib/html/MenuEvent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { os } from "../../../viewer/utils/os.js";

export function addContextMenuListener(elem, callback) {
//failCallback will be called when the press is not long enough to considered a long press
export function addContextMenuListener(elem, callback, failCallback = () => {}) {
if (!elem || !callback) return;

let timeout = null;
Expand Down Expand Up @@ -54,6 +55,7 @@ export function addContextMenuListener(elem, callback) {
const touchEndHandler = (event) => {
event.preventDefault();
if (timeout) {
failCallback(event);
clearTimeout(timeout);
timeout = null;
}
Expand Down

0 comments on commit e269006

Please sign in to comment.