diff --git a/modules/modes/select_data.js b/modules/modes/select_data.js index 1313ad3bc..a631798c9 100644 --- a/modules/modes/select_data.js +++ b/modules/modes/select_data.js @@ -47,7 +47,7 @@ export function modeSelectData(context, selectedDatum) { // Return to browse mode if selected DOM elements have // disappeared because the user moved them out of view.. var source = d3_event && d3_event.type === 'zoom' && d3_event.sourceEvent; - if (drawn && source && (source.type === 'mousemove' || source.type === 'touchmove')) { + if (drawn && source && (source.type === 'pointermove' || source.type === 'mousemove' || source.type === 'touchmove')) { context.enter(modeBrowse(context)); } } else { diff --git a/modules/modes/select_error.js b/modules/modes/select_error.js index 2270f2c2c..4a7cb8e80 100644 --- a/modules/modes/select_error.js +++ b/modules/modes/select_error.js @@ -124,7 +124,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorService) // Return to browse mode if selected DOM elements have // disappeared because the user moved them out of view.. var source = d3_event && d3_event.type === 'zoom' && d3_event.sourceEvent; - if (drawn && source && (source.type === 'mousemove' || source.type === 'touchmove')) { + if (drawn && source && (source.type === 'pointermove' || source.type === 'mousemove' || source.type === 'touchmove')) { context.enter(modeBrowse(context)); } diff --git a/modules/modes/select_note.js b/modules/modes/select_note.js index 1aacb1205..c7e652ee4 100644 --- a/modules/modes/select_note.js +++ b/modules/modes/select_note.js @@ -67,7 +67,7 @@ export function modeSelectNote(context, selectedNoteID) { // Return to browse mode if selected DOM elements have // disappeared because the user moved them out of view.. var source = d3_event && d3_event.type === 'zoom' && d3_event.sourceEvent; - if (drawn && source && (source.type === 'mousemove' || source.type === 'touchmove')) { + if (drawn && source && (source.type === 'pointermove' || source.type === 'mousemove' || source.type === 'touchmove')) { context.enter(modeBrowse(context)); } diff --git a/modules/services/streetside.js b/modules/services/streetside.js index 8c1b54719..3c81d218b 100644 --- a/modules/services/streetside.js +++ b/modules/services/streetside.js @@ -470,14 +470,16 @@ export default { _pannellumViewer = window.pannellum.viewer('ideditor-viewer-streetside', options); + var pointerPrefix = 'PointerEvent' in window ? 'pointer' : 'mouse'; + _pannellumViewer - .on('mousedown', () => { + .on(pointerPrefix + 'down', () => { d3_select(window) - .on('mousemove.pannellum', () => { dispatch.call('viewerChanged'); }); + .on(pointerPrefix + 'move.pannellum', () => { dispatch.call('viewerChanged'); }); }) - .on('mouseup', () => { + .on(pointerPrefix + 'up', () => { d3_select(window) - .on('mousemove.pannellum', null); + .on(pointerPrefix + 'move.pannellum', null); // continue dispatching events for a few seconds, in case viewer has inertia. let t = d3_timer(elapsed => { diff --git a/modules/ui/intro/line.js b/modules/ui/intro/line.js index a296642f5..6e4440dcc 100644 --- a/modules/ui/intro/line.js +++ b/modules/ui/intro/line.js @@ -200,7 +200,7 @@ export function uiIntroLine(context, reveal) { function retryIntersect() { - d3_select(window).on('mousedown.intro', eventCancel, true); + d3_select(window).on('pointerdown.intro mousedown.intro', eventCancel, true); var box = pad(tulipRoadIntersection, 80, context); reveal(box, @@ -1054,7 +1054,7 @@ export function uiIntroLine(context, reveal) { chapter.exit = function() { timeouts.forEach(window.clearTimeout); - d3_select(window).on('mousedown.intro', null, true); + d3_select(window).on('pointerdown.intro mousedown.intro', null, true); context.on('enter.intro exit.intro', null); context.map().on('move.intro drawn.intro', null); context.history().on('change.intro', null); diff --git a/modules/ui/panels/location.js b/modules/ui/panels/location.js index 59d04f344..21a7ae14f 100644 --- a/modules/ui/panels/location.js +++ b/modules/ui/panels/location.js @@ -57,14 +57,14 @@ export function uiPanelLocation(context) { selection.call(redraw); context.surface() - .on('mousemove.info-location', function() { + .on(('PointerEvent' in window ? 'pointer' : 'mouse') + 'move.info-location', function() { selection.call(redraw); }); }; panel.off = function() { context.surface() - .on('mousemove.info-location', null); + .on('.info-location', null); }; panel.id = 'location'; diff --git a/modules/ui/sections/feature_type.js b/modules/ui/sections/feature_type.js index 3bd55a427..a43ff335d 100644 --- a/modules/ui/sections/feature_type.js +++ b/modules/ui/sections/feature_type.js @@ -83,11 +83,7 @@ export function uiSectionFeatureType(context) { .on('click', function() { dispatch.call('choose', this, _presets); }) - .on('mousedown', function() { - d3_event.preventDefault(); - d3_event.stopPropagation(); - }) - .on('mouseup', function() { + .on('pointerdown pointerup mousedown mouseup', function() { d3_event.preventDefault(); d3_event.stopPropagation(); });