- Fix: Map extension click events to "mousedown" so they can be received

on touch devices (since `touch.js` changes `touchstart` to
    `mousedown`) (@ClemArt); closes #168
- Fix: Ensure extension `mouseup` events run on "zoom" and "select"
  modes (@iuyiuy); closes #159
master
Brett Zamir 2018-10-19 20:38:18 +08:00
parent 253732025a
commit 8024304a96
11 changed files with 58 additions and 14 deletions

View File

@ -1,5 +1,10 @@
# ?
- Fix: Map extension click events to "mousedown" so they can be received
on touch devices (since `touch.js` changes `touchstart` to
`mousedown`) (@ClemArt); closes #168
- Fix: Ensure extension `mouseup` events run on "zoom" and "select"
modes (@iuyiuy); closes #159
- Enhancement: Allow "Escape" to work with hotkeys within text boxes;
allows escaping out of source textarea (part of #291)
- Enhancement: Allow 'a' also with meta key (command in Mac, ctrl otherwise)

12
dist/index-es.js vendored
View File

@ -16059,7 +16059,7 @@ function SvgCanvas(container, config) {
}
}
return;
break;
case 'zoom':
if (rubberBox != null) {
@ -16074,7 +16074,7 @@ function SvgCanvas(container, config) {
height: Math.abs(realY - rStartY),
factor: factor
});
return;
break;
case 'fhpath':
// Check that the path contains at least 2 points; a degenerate one-point path
@ -31090,6 +31090,12 @@ editor.init = function () {
// Add given events to button
$$b.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@ -33470,6 +33476,8 @@ editor.init = function () {
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12
dist/index-umd.js vendored
View File

@ -16065,7 +16065,7 @@
}
}
return;
break;
case 'zoom':
if (rubberBox != null) {
@ -16080,7 +16080,7 @@
height: Math.abs(realY - rStartY),
factor: factor
});
return;
break;
case 'fhpath':
// Check that the path contains at least 2 points; a degenerate one-point path
@ -31096,6 +31096,12 @@
// Add given events to button
$$b.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@ -33476,6 +33482,8 @@
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3301,6 +3301,11 @@ editor.init = function () {
// Add given events to button
$.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@ -5248,6 +5253,8 @@ editor.init = function () {
btn = $(opts.sel);
if (!btn.length) { return true; } // Skip if markup does not exist
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}

View File

@ -2615,7 +2615,7 @@ const mouseUp = function (evt) {
}
}
}
return;
break;
case 'zoom':
if (rubberBox != null) {
rubberBox.setAttribute('display', 'none');
@ -2628,7 +2628,7 @@ const mouseUp = function (evt) {
height: Math.abs(realY - rStartY),
factor
});
return;
break;
case 'fhpath':
// Check that the path contains at least 2 points; a degenerate one-point path
// causes problems.

View File

@ -16062,7 +16062,7 @@
}
}
return;
break;
case 'zoom':
if (rubberBox != null) {
@ -16077,7 +16077,7 @@
height: Math.abs(realY - rStartY),
factor: factor
});
return;
break;
case 'fhpath':
// Check that the path contains at least 2 points; a degenerate one-point path
@ -31093,6 +31093,12 @@
// Add given events to button
$$b.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@ -33473,6 +33479,8 @@
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}

View File

@ -16062,7 +16062,7 @@
}
}
return;
break;
case 'zoom':
if (rubberBox != null) {
@ -16077,7 +16077,7 @@
height: Math.abs(realY - rStartY),
factor: factor
});
return;
break;
case 'fhpath':
// Check that the path contains at least 2 points; a degenerate one-point path
@ -31093,6 +31093,12 @@
// Add given events to button
$$b.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@ -33473,6 +33479,8 @@
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}