Skip to content

Commit

Permalink
fix: Replace pointerH and pointerW with pointerHeight and pointerWidth (
Browse files Browse the repository at this point in the history
#391)

* feat: update input TS file

* fix: revert changes

* fix: replace pointerH and pointerW with pointerHeight and pointerWidth
  • Loading branch information
soumyaloka authored Oct 25, 2023
1 parent e355efd commit 8711fbf
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions packages/@lightningjs/ui-components/src/textures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ class Bubble extends lng.Texture {
this._w = 0;
this._h = 0;
this._radius = 0;
this._pointerW = 0;
this._pointerH = 0;
this._pointerWidth = 0;
this._pointerHeight = 0;
this._strokeWidth = 0;
this._color = 'white';
}
Expand Down Expand Up @@ -330,22 +330,22 @@ class Bubble extends lng.Texture {
return this._radius;
}

set pointerW(pointerW) {
this._pointerW = pointerW;
set pointerWidth(pointerWidth) {
this._pointerWidth = pointerWidth;
this._changed();
}

get pointerW() {
return this._pointerW;
get pointerWidth() {
return this._pointerWidth;
}

set pointerH(pointerH) {
this._pointerH = pointerH;
set pointerHeight(pointerHeight) {
this._pointerHeight = pointerHeight;
this._changed();
}

get pointerH() {
return this._pointerH;
get pointerHeight() {
return this._pointerHeight;
}

set strokeWidth(strokeWidth) {
Expand All @@ -371,8 +371,8 @@ class Bubble extends lng.Texture {
w = 0,
h = 0,
radius = 0,
pointerW = 0,
pointerH = 0,
pointerWidth = 0,
pointerHeight = 0,
strokeWidth = 1,
color = 'white'
}) {
Expand All @@ -394,7 +394,7 @@ class Bubble extends lng.Texture {
const rightX = leftX + w;
const topY = initialCoord;
const bottomY = topY + h;
const bottomBubbleY = bottomY - pointerH;
const bottomBubbleY = bottomY - pointerHeight;
const isRadiusAnArray = Array.isArray(radius);
// start: top left
ctx.beginPath();
Expand Down Expand Up @@ -423,11 +423,11 @@ class Bubble extends lng.Texture {
);

// bottom side, right of point
ctx.lineTo(w / 2 + pointerW / 2, bottomBubbleY);
ctx.lineTo(w / 2 + pointerWidth / 2, bottomBubbleY);

// point
ctx.arcTo(w / 2, bottomY, w / 2 - pointerW / 2, bottomBubbleY, 2);
ctx.lineTo(w / 2 - pointerW / 2, bottomBubbleY);
ctx.arcTo(w / 2, bottomY, w / 2 - pointerWidth / 2, bottomBubbleY, 2);
ctx.lineTo(w / 2 - pointerWidth / 2, bottomBubbleY);

// bottom side, left of point
ctx.lineTo(leftX + (isRadiusAnArray ? radius[3] : radius), bottomBubbleY);
Expand Down Expand Up @@ -461,8 +461,8 @@ class Bubble extends lng.Texture {
}

_getLookupId() {
const { w, h, radius, pointerW, pointerH, color } = this;
return `__bubble_${w}x${h}_radius-${radius}_pointer-${pointerW}x${pointerH}_fill-${color}`;
const { w, h, radius, pointerWidth, pointerHeight, color } = this;
return `__bubble_${w}x${h}_radius-${radius}_pointer-${pointerWidth}x${pointerHeight}_fill-${color}`;
}

_getSourceLoader() {
Expand Down

0 comments on commit 8711fbf

Please sign in to comment.