eslint recommended

This commit is contained in:
Thibaut(Teebo) 2024-10-29 14:46:32 +01:00
parent ae4f53b422
commit 338696c691
2 changed files with 26 additions and 32 deletions

View File

@ -249,11 +249,10 @@ export class Stage extends Container<Layer> {
* @name Konva.Stage#clear * @name Konva.Stage#clear
*/ */
clear() { clear() {
let layers = this.children, const layers = this.children,
len = layers.length, len = layers.length;
n;
for (n = 0; n < len; n++) { for (let n = 0; n < len; n++) {
layers[n].clear(); layers[n].clear();
} }
return this; return this;
@ -367,12 +366,11 @@ export class Stage extends Container<Layer> {
if (!pos) { if (!pos) {
return null; return null;
} }
let layers = this.children, const layers = this.children,
len = layers.length, len = layers.length,
end = len - 1, end = len - 1;
n;
for (n = end; n >= 0; n--) { for (let n = end; n >= 0; n--) {
const shape = layers[n].getIntersection(pos); const shape = layers[n].getIntersection(pos);
if (shape) { if (shape) {
return shape; return shape;
@ -820,8 +818,8 @@ export class Stage extends Container<Layer> {
* }); * });
*/ */
setPointersPositions(evt) { setPointersPositions(evt) {
let contentPosition = this._getContentPosition(), const contentPosition = this._getContentPosition();
x: number | null = null, let x: number | null = null,
y: number | null = null; y: number | null = null;
evt = evt ? evt : window.event; evt = evt ? evt : window.event;

View File

@ -4,7 +4,7 @@ import { Node, NodeConfig } from './Node';
import { Konva } from './Global'; import { Konva } from './Global';
import { Line } from './shapes/Line'; import { Line } from './shapes/Line';
let blacklist = { const blacklist = {
node: 1, node: 1,
duration: 1, duration: 1,
easing: 1, easing: 1,
@ -14,8 +14,8 @@ let blacklist = {
PAUSED = 1, PAUSED = 1,
PLAYING = 2, PLAYING = 2,
REVERSING = 3, REVERSING = 3,
idCounter = 0,
colorAttrs = ['fill', 'stroke', 'shadowColor']; colorAttrs = ['fill', 'stroke', 'shadowColor'];
let idCounter = 0;
class TweenEngine { class TweenEngine {
prop: string; prop: string;
@ -195,12 +195,12 @@ export class Tween {
onUpdate: Function | undefined; onUpdate: Function | undefined;
constructor(config: TweenConfig) { constructor(config: TweenConfig) {
let that = this, const that = this,
node = config.node as any, node = config.node as any,
nodeId = node._id, nodeId = node._id,
duration,
easing = config.easing || Easings.Linear, easing = config.easing || Easings.Linear,
yoyo = !!config.yoyo, yoyo = !!config.yoyo;
let duration,
key; key;
if (typeof config.duration === 'undefined') { if (typeof config.duration === 'undefined') {
@ -266,26 +266,23 @@ export class Tween {
this.onUpdate = config.onUpdate; this.onUpdate = config.onUpdate;
} }
_addAttr(key, end) { _addAttr(key, end) {
let node = this.node, const node = this.node,
nodeId = node._id, nodeId = node._id;
start, let diff,
diff,
tweenId,
n,
len, len,
trueEnd, trueEnd,
trueStart, trueStart,
endRGBA; endRGBA;
// remove conflict from tween map if it exists // remove conflict from tween map if it exists
tweenId = Tween.tweens[nodeId][key]; const tweenId = Tween.tweens[nodeId][key];
if (tweenId) { if (tweenId) {
delete Tween.attrs[nodeId][tweenId][key]; delete Tween.attrs[nodeId][tweenId][key];
} }
// add to tween map // add to tween map
start = node.getAttr(key); let start = node.getAttr(key);
if (Util._isArray(end)) { if (Util._isArray(end)) {
diff = []; diff = [];
@ -310,7 +307,7 @@ export class Tween {
} }
if (key.indexOf('fill') === 0) { if (key.indexOf('fill') === 0) {
for (n = 0; n < len; n++) { for (let n = 0; n < len; n++) {
if (n % 2 === 0) { if (n % 2 === 0) {
diff.push(end[n] - start[n]); diff.push(end[n] - start[n]);
} else { } else {
@ -326,7 +323,7 @@ export class Tween {
} }
} }
} else { } else {
for (n = 0; n < len; n++) { for (let n = 0; n < len; n++) {
diff.push(end[n] - start[n]); diff.push(end[n] - start[n]);
} }
} }
@ -353,9 +350,9 @@ export class Tween {
Tween.tweens[nodeId][key] = this._id; Tween.tweens[nodeId][key] = this._id;
} }
_tweenFunc(i) { _tweenFunc(i) {
let node = this.node, const node = this.node,
attrs = Tween.attrs[node._id][this._id], attrs = Tween.attrs[node._id][this._id];
key, let key,
attr, attr,
start, start,
diff, diff,
@ -525,14 +522,13 @@ export class Tween {
* @name Konva.Tween#destroy * @name Konva.Tween#destroy
*/ */
destroy() { destroy() {
let nodeId = this.node._id, const nodeId = this.node._id,
thisId = this._id, thisId = this._id,
attrs = Tween.tweens[nodeId], attrs = Tween.tweens[nodeId];
key;
this.pause(); this.pause();
for (key in attrs) { for (const key in attrs) {
delete Tween.tweens[nodeId][key]; delete Tween.tweens[nodeId][key];
} }