Skip to content

Commit

Permalink
fix(touchInteractionEvents): fire dblClick with button=1
Browse files Browse the repository at this point in the history
* fixes upstream bpmn-io/bpmn-js#618
* testing infrastructure is not set up here. Hence I am skipping the
  testing bit. We need to set up proper testing, when reworking the
entire touch module.
* manual integration test done with bpmn-js direct editing module and
  ipad safari
  • Loading branch information
MaxTru authored and Niklas Kiefer committed Jan 6, 2022
1 parent 26cfc93 commit 52af94e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/features/touch/TouchInteractionEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,24 @@ export default function TouchInteractionEvents(
// the touch recognizer
var recognizer;

function handler(type) {
function handler(type, buttonType) {

return function(event) {
log('element', type, event);

interactionEvents.fire(type, event);
var gfx = getGfx(event.target),
element = gfx && elementRegistry.get(gfx);

// translate into an actual mouse click event
if (buttonType) {
event.srcEvent.button = buttonType;
}

return interactionEvents.fire(type, event, element);
};
}


function getGfx(target) {
var node = domClosest(target, 'svg, .djs-element', true);
return node;
Expand All @@ -168,10 +177,6 @@ export default function TouchInteractionEvents(
// touch recognizer
recognizer = createTouchRecognizer(svg);

recognizer.on('doubletap', handler('element.dblclick'));

recognizer.on('tap', handler('element.click'));

function startGrabCanvas(event) {

log('canvas', 'grab start');
Expand Down Expand Up @@ -248,6 +253,9 @@ export default function TouchInteractionEvents(
recognizer.on('pinchcancel', end);
}

recognizer.on('tap', handler('element.click'));
recognizer.on('doubletap', handler('element.dblclick', 1));

recognizer.on('panstart', startGrab);
recognizer.on('press', startGrab);

Expand Down

0 comments on commit 52af94e

Please sign in to comment.