优化代码

This commit is contained in:
ival 2021-04-04 20:37:32 +08:00
parent 5870a3814c
commit e3900b6f9e

View File

@ -162,14 +162,7 @@ export default class Controller extends Eventful {
const dy2 = Math.pow(e.dy, 2);
const scale = this.option.getScaleRate();
const diff = Math.ceil(Math.sqrt(dx2+dy2));
if (scale > 1) {
return true;
} else if (diff > 2/scale) {
return true;
}
return false;
return scale > 1 && (diff > 2/scale);
}
mousedown(e) {