Commit ab1e0fa9 authored by Andray's avatar Andray

fix lint and console warning

parent 85abbbb8
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
['mousedown', 'touchstart'].forEach((eventType) => { ['mousedown', 'touchstart'].forEach((eventType) => {
resizeHandle.addEventListener(eventType, (evt) => { resizeHandle.addEventListener(eventType, (evt) => {
if (eventType.startsWith('mouse')){ if (eventType.startsWith('mouse')) {
if (evt.button !== 0) return; if (evt.button !== 0) return;
} else { } else {
if (evt.changedTouches.length !== 1) return; if (evt.changedTouches.length !== 1) return;
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
R.handle = resizeHandle; R.handle = resizeHandle;
R.leftCol = leftCol; R.leftCol = leftCol;
R.leftColStartWidth = leftCol.offsetWidth; R.leftColStartWidth = leftCol.offsetWidth;
if (eventType.startsWith('mouse')){ if (eventType.startsWith('mouse')) {
R.screenX = evt.screenX; R.screenX = evt.screenX;
} else { } else {
R.screenX = evt.changedTouches[0].screenX; R.screenX = evt.changedTouches[0].screenX;
...@@ -104,20 +104,23 @@ ...@@ -104,20 +104,23 @@
['mousemove', 'touchmove'].forEach((eventType) => { ['mousemove', 'touchmove'].forEach((eventType) => {
window.addEventListener(eventType, (evt) => { window.addEventListener(eventType, (evt) => {
if (eventType.startsWith('mouse')){ if (eventType.startsWith('mouse')) {
if (evt.button !== 0) return; if (evt.button !== 0) return;
} else { } else {
if (evt.changedTouches.length !== 1) return; if (evt.changedTouches.length !== 1) return;
} }
if (R.tracking) { if (R.tracking) {
if (eventType.startsWith('mouse')) {
evt.preventDefault(); evt.preventDefault();
}
evt.stopPropagation(); evt.stopPropagation();
if (eventType.startsWith('mouse')){ let delta = 0;
var delta = R.screenX - evt.screenX; if (eventType.startsWith('mouse')) {
delta = R.screenX - evt.screenX;
} else { } else {
var delta = R.screenX - evt.changedTouches[0].screenX; delta = R.screenX - evt.changedTouches[0].screenX;
} }
const leftColWidth = Math.max(Math.min(R.leftColStartWidth - delta, R.parent.offsetWidth - GRADIO_MIN_WIDTH - PAD), GRADIO_MIN_WIDTH); const leftColWidth = Math.max(Math.min(R.leftColStartWidth - delta, R.parent.offsetWidth - GRADIO_MIN_WIDTH - PAD), GRADIO_MIN_WIDTH);
setLeftColGridTemplate(R.parent, leftColWidth); setLeftColGridTemplate(R.parent, leftColWidth);
...@@ -127,7 +130,7 @@ ...@@ -127,7 +130,7 @@
['mouseup', 'touchend'].forEach((eventType) => { ['mouseup', 'touchend'].forEach((eventType) => {
window.addEventListener(eventType, (evt) => { window.addEventListener(eventType, (evt) => {
if (eventType.startsWith('mouse')){ if (eventType.startsWith('mouse')) {
if (evt.button !== 0) return; if (evt.button !== 0) return;
} else { } else {
if (evt.changedTouches.length !== 1) return; if (evt.changedTouches.length !== 1) return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment