Update more mouse events to use pointer events if available (re: #5505)

This commit is contained in:
Quincy Morgan
2020-05-08 16:10:15 -07:00
parent 77552c4430
commit 95dc16b7a6
7 changed files with 14 additions and 16 deletions
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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));
}
+1 -1
View File
@@ -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));
}
+6 -4
View File
@@ -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 => {
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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';
+1 -5
View File
@@ -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();
});