mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-26 01:47:49 +02:00
Update more mouse events to use pointer events if available (re: #5505)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user