优化代码

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 dy2 = Math.pow(e.dy, 2);
const scale = this.option.getScaleRate(); const scale = this.option.getScaleRate();
const diff = Math.ceil(Math.sqrt(dx2+dy2)); const diff = Math.ceil(Math.sqrt(dx2+dy2));
return scale > 1 && (diff > 2/scale);
if (scale > 1) {
return true;
} else if (diff > 2/scale) {
return true;
}
return false;
} }
mousedown(e) { mousedown(e) {