Skip to content

Commit 42f8040

Browse files
committed
Use _skin instead of getter in "touching" methods
This provides a slight but noticeable performance improvement, and gains back some of what was lost in the previous commit.
1 parent fe2dce5 commit 42f8040

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Drawable.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,16 @@ class Drawable {
494494

495495
_isTouchingNearest (vec) {
496496
const localPosition = getLocalPosition(this, vec);
497-
if (!this.skin.pointInsideLogicalBounds(localPosition)) return false;
497+
if (!this._skin.pointInsideLogicalBounds(localPosition)) return false;
498498
if (this.enabledEffects !== 0) EffectTransform.transformPoint(this, localPosition, localPosition);
499-
return this.skin._silhouette.isTouchingNearest(localPosition);
499+
return this._skin._silhouette.isTouchingNearest(localPosition);
500500
}
501501

502502
_isTouchingLinear (vec) {
503503
const localPosition = getLocalPosition(this, vec);
504-
if (!this.skin.pointInsideLogicalBounds(localPosition)) return false;
504+
if (!this._skin.pointInsideLogicalBounds(localPosition)) return false;
505505
if (this.enabledEffects !== 0) EffectTransform.transformPoint(this, localPosition, localPosition);
506-
return this.skin._silhouette.isTouchingLinear(localPosition);
506+
return this._skin._silhouette.isTouchingLinear(localPosition);
507507
}
508508

509509
/**
@@ -767,7 +767,7 @@ class Drawable {
767767
*/
768768
static sampleColor4b (vec, drawable, dst, effectMask) {
769769
const localPosition = getLocalPosition(drawable, vec);
770-
if (!this.skin.pointInsideLogicalBounds(localPosition)) {
770+
if (!this._skin.pointInsideLogicalBounds(localPosition)) {
771771
dst[0] = 0;
772772
dst[1] = 0;
773773
dst[2] = 0;
@@ -780,9 +780,9 @@ class Drawable {
780780

781781
const textColor =
782782
// commenting out to only use nearest for now
783-
// drawable.skin.useNearest(drawable._scale, drawable) ?
784-
drawable.skin._silhouette.colorAtNearest(localPosition, dst);
785-
// : drawable.skin._silhouette.colorAtLinear(localPosition, dst);
783+
// drawable._skin.useNearest(drawable._scale, drawable) ?
784+
drawable._skin._silhouette.colorAtNearest(localPosition, dst);
785+
// : drawable._skin._silhouette.colorAtLinear(localPosition, dst);
786786

787787
if (drawable.enabledEffects === 0) return textColor;
788788
return EffectTransform.transformColor(drawable, textColor, effectMask);

0 commit comments

Comments
 (0)