fix(label-editing): use new isTouch detection for conditional activation
Chrome and other modern desktop browsers ship with touch features out of the box. Because of that, it is not possible to use the check ``` 'ontouchstart' in document.documentElement ```
This commit is contained in:
parent
2b37cebeb6
commit
7e928ec709
|
@ -40,29 +40,37 @@ function LabelEditingProvider(eventBus, canvas, directEditing, commandStack, res
|
|||
directEditing.cancel();
|
||||
});
|
||||
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
// we deactivate automatic label editing on mobile devices
|
||||
|
||||
eventBus.on('directEditing.activate', function(event) {
|
||||
resizeHandles.removeResizers();
|
||||
});
|
||||
|
||||
eventBus.on('create.end', 500, function(event) {
|
||||
|
||||
var element = event.shape,
|
||||
canExecute = event.context.canExecute,
|
||||
isTouch;
|
||||
|
||||
// TODO(nikku): we need to find a way to support the direct editing
|
||||
// on mobile devices; right now this will break for desworkflowediting on mobile devices
|
||||
// as it breaks the user interaction workflow
|
||||
|
||||
// TODO(nre): we should temporarily focus the edited element here
|
||||
// and release the focused viewport after the direct edit operation is finished
|
||||
} else {
|
||||
eventBus.on('create.end', 500, function(event) {
|
||||
var element = event.shape,
|
||||
canExecute = event.context.canExecute;
|
||||
if (isTouch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!canExecute) {
|
||||
return;
|
||||
}
|
||||
if (!canExecute) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is(element, 'bpmn:Task') || is(element, 'bpmn:TextAnnotation') ||
|
||||
(is(element, 'bpmn:SubProcess') && !isExpanded(element))) {
|
||||
directEditing.activate(element);
|
||||
if (is(element, 'bpmn:Task') || is(element, 'bpmn:TextAnnotation') ||
|
||||
(is(element, 'bpmn:SubProcess') && !isExpanded(element))) {
|
||||
directEditing.activate(element);
|
||||
}
|
||||
});
|
||||
|
||||
resizeHandles.removeResizers();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
LabelEditingProvider.$inject = [ 'eventBus', 'canvas', 'directEditing', 'commandStack', 'resizeHandles' ];
|
||||
|
|
Loading…
Reference in New Issue