From 32a3a6ec3c91e65200bcce5e28e57021f0238132 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:54:48 +0000 Subject: [PATCH 1/9] update scripts to not override latest tag --- .github/workflows/release.yml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a61cba6..6424cdeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,6 @@ jobs: brew update brew install gh - name: Generate Release - run: gh release create ${{github.ref_name}} --generate-notes + run: gh release create ${{github.ref_name}} --generate-notes --draft env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 573c6c47..78ba8b57 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "lint": "xs lint --max-warnings 0", "lint:fix": "xs lint --fix", "prepare": "husky install", - "release": "xs bump,build,docs,publish,git-push", + "release": "xs bump,build,docs && npm run release:dist && git-push", + "release:dist": "npm publish --tag latest-1.x", "serve": "xs serve", "storybook": "storybook dev -p 6006", "storybook:build": "storybook build --output-dir docs/storybook", From 53ab8559f09d3bcca35b384326595fc18e99097f Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:56:20 +0000 Subject: [PATCH 2/9] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d14c148..497f09e1 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Here are some useful resources: Depending on your version of PixiJS, you'll need to figure out which major version of PixiUI to use. -| PixiJS | PixiUI | +| PixiJS | PixiJS UI | |-------------|----------------| | v7.x | v1.x | | v8.x | v2.x | From cf913eb0bccf6ec490428fa761615101addcdd0b Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Fri, 22 Mar 2024 14:23:12 +0000 Subject: [PATCH 3/9] Fix: Adjust Fancy Button Content Fitting --- src/FancyButton.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/FancyButton.ts b/src/FancyButton.ts index 26ba63b8..fe0f8606 100644 --- a/src/FancyButton.ts +++ b/src/FancyButton.ts @@ -63,6 +63,7 @@ export type ButtonOptions = ViewsInput & { iconOffset?: Offset; animations?: StateAnimations; nineSliceSprite?: [number, number, number, number]; + ignoreRefitting?: boolean; }; /** @@ -135,6 +136,9 @@ export class FancyButton extends ButtonContainer /** Anchor point of the button. */ anchor: ObservablePoint; + protected _textBaseScale = 1; + protected _iconBaseScale = 1; + /** * Creates a button with a lot of tweaks. * @param {object} options - Button options. @@ -299,6 +303,7 @@ export class FancyButton extends ButtonContainer protected createTextView(text: AnyText) { this._views.textView = getTextView(text); + this._textBaseScale = this._views.textView.scale.x; this._views.textView.anchor.set(0); this.innerView.addChild(this._views.textView); @@ -374,6 +379,11 @@ export class FancyButton extends ButtonContainer if (activeView) { + if (!this.options.ignoreRefitting) + { + this._views.textView.scale.set(this._textBaseScale); + } + fitToView(activeView, this._views.textView, this.padding); this._views.textView.x = activeView.x + (activeView.width / 2); @@ -403,6 +413,11 @@ export class FancyButton extends ButtonContainer return; } + if (!this.options.ignoreRefitting) + { + this._views.iconView.scale.set(this._iconBaseScale); + } + fitToView(activeView, this._views.iconView, this.padding); (this._views.iconView as Sprite).anchor?.set(0); @@ -633,6 +648,7 @@ export class FancyButton extends ButtonContainer } this._views.iconView = getView(view); + this._iconBaseScale = this._views.iconView.scale.x; if (!this._views.iconView.parent) { From 845f01d54628d295c44c087f76085d6077e5535a Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Fri, 22 Mar 2024 19:59:04 +0000 Subject: [PATCH 4/9] Address Feedback --- src/FancyButton.ts | 88 +++++++++++++++++++++++++++++++++++----- src/utils/helpers/fit.ts | 30 +++++++++++--- 2 files changed, 103 insertions(+), 15 deletions(-) diff --git a/src/FancyButton.ts b/src/FancyButton.ts index fe0f8606..b379cd12 100644 --- a/src/FancyButton.ts +++ b/src/FancyButton.ts @@ -61,6 +61,8 @@ export type ButtonOptions = ViewsInput & { offset?: Offset; textOffset?: Offset; iconOffset?: Offset; + textScale?: Pos | number; + iconScale?: Pos | number; animations?: StateAnimations; nineSliceSprite?: [number, number, number, number]; ignoreRefitting?: boolean; @@ -136,8 +138,11 @@ export class FancyButton extends ButtonContainer /** Anchor point of the button. */ anchor: ObservablePoint; - protected _textBaseScale = 1; - protected _iconBaseScale = 1; + /** Base text scaling to take into account when fitting inside the button */ + protected _textBaseScale: Pos = { x: 1, y: 1 }; + + /** Base icon scaling to take into account when fitting inside the button */ + protected _iconBaseScale: Pos = { x: 1, y: 1 }; /** * Creates a button with a lot of tweaks. @@ -176,6 +181,8 @@ export class FancyButton extends ButtonContainer offset, textOffset, iconOffset, + textScale, + iconScale, scale, anchor, anchorX, @@ -195,6 +202,8 @@ export class FancyButton extends ButtonContainer this.offset = offset; this.textOffset = textOffset; this.iconOffset = iconOffset; + this.textBaseScale = textScale; + this.iconBaseScale = iconScale; this.scale.set(scale ?? 1); if (animations) @@ -303,7 +312,15 @@ export class FancyButton extends ButtonContainer protected createTextView(text: AnyText) { this._views.textView = getTextView(text); - this._textBaseScale = this._views.textView.scale.x; + + // If text scale has not manually been set, we will overwrite the base scale with the new text view scale. + if (this.options?.textScale === undefined) + { + const { x, y } = this._views.textView.scale; + + this._textBaseScale = { x, y }; + } + this._views.textView.anchor.set(0); this.innerView.addChild(this._views.textView); @@ -379,12 +396,12 @@ export class FancyButton extends ButtonContainer if (activeView) { - if (!this.options.ignoreRefitting) + if (this.options && !this.options.ignoreRefitting) { - this._views.textView.scale.set(this._textBaseScale); + this._views.textView.scale.set(this._textBaseScale.x, this._textBaseScale.y); } - fitToView(activeView, this._views.textView, this.padding); + fitToView(activeView, this._views.textView, this.padding, false); this._views.textView.x = activeView.x + (activeView.width / 2); this._views.textView.y = activeView.y + (activeView.height / 2); @@ -413,12 +430,12 @@ export class FancyButton extends ButtonContainer return; } - if (!this.options.ignoreRefitting) + if (this.options && !this.options.ignoreRefitting) { - this._views.iconView.scale.set(this._iconBaseScale); + this._views.iconView.scale.set(this._iconBaseScale.x, this._iconBaseScale.y); } - fitToView(activeView, this._views.iconView, this.padding); + fitToView(activeView, this._views.iconView, this.padding, false); (this._views.iconView as Sprite).anchor?.set(0); @@ -648,7 +665,14 @@ export class FancyButton extends ButtonContainer } this._views.iconView = getView(view); - this._iconBaseScale = this._views.iconView.scale.x; + + // If icon scale has not manually been set, we will overwrite the base scale with the new icon view scale. + if (this.options?.iconScale === undefined) + { + const { x, y } = this._views.iconView.scale; + + this._iconBaseScale = { x, y }; + } if (!this._views.iconView.parent) { @@ -818,6 +842,50 @@ export class FancyButton extends ButtonContainer return this._textOffset; } + /** + * Sets the base scale for the text view to take into account when fitting inside the button. + * @param {Pos | number} scale - base scale of the text view. + */ + set textBaseScale(scale: Pos | number) + { + // Apply to the options so that the manual scale is prioritized. + this.options.textScale = scale; + if (scale === undefined) return; + const isNumber = typeof scale === 'number'; + + this._textBaseScale.x = isNumber ? scale : scale.x ?? 1; + this._textBaseScale.y = isNumber ? scale : scale.y ?? 1; + this.adjustTextView(this.state); + } + + /** Returns the text view base scale. */ + get textBaseScale(): Pos + { + return this.textBaseScale; + } + + /** + * Sets the base scale for the icon view to take into account when fitting inside the button. + * @param {Pos | number} scale - base scale of the icon view. + */ + set iconBaseScale(scale: Pos | number) + { + // Apply to the options so that the manual scale is prioritized. + this.options.iconScale = scale; + if (scale === undefined) return; + const isNumber = typeof scale === 'number'; + + this._iconBaseScale.x = isNumber ? scale : scale.x ?? 1; + this._iconBaseScale.y = isNumber ? scale : scale.y ?? 1; + this.adjustIconView(this.state); + } + + /** Returns the icon view base scale. */ + get iconBaseScale(): Pos + { + return this.iconBaseScale; + } + /** * Sets width of a FancyButtons state views. * If nineSliceSprite is set, then width will be set to nineSliceSprites of a views. diff --git a/src/utils/helpers/fit.ts b/src/utils/helpers/fit.ts index 56ec0d80..6574dccf 100644 --- a/src/utils/helpers/fit.ts +++ b/src/utils/helpers/fit.ts @@ -1,6 +1,6 @@ import { Container } from 'pixi.js'; -export function fitToView(parent: Container, child: Container, padding = 0) +export function fitToView(parent: Container, child: Container, padding = 0, uniformScaling = true) { let scaleX = child.scale.x; let scaleY = child.scale.y; @@ -18,18 +18,38 @@ export function fitToView(parent: Container, child: Container, padding = 0) if (widthOverflow < 0) { - scaleX = maxWidth / (child.width * scaleX); + scaleX = maxWidth / (child.width / scaleX); } if (heightOverflow < 0) { - scaleY = maxHeight / (child.height * scaleY); + scaleY = maxHeight / (child.height / scaleY); } if (scaleX <= 0 || scaleY <= 0) { - child.visible = false; + child.scale.set(0); + + return; } - child.scale.set(Math.min(scaleX, scaleY)); + if (uniformScaling || child.scale.x === child.scale.y) + { + const scale = Math.min(scaleX, scaleY); + + child.scale.set(scale, scale); + } + else + { + const ratio = child.scale.x / child.scale.y; + + if (widthOverflow < heightOverflow) + { + child.scale.set(scaleX, scaleX / ratio); + } + else + { + child.scale.set(scaleY * ratio, scaleY); + } + } } From 1f67066e1fe3652fe87c52cb8544776fd03d2530 Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Fri, 22 Mar 2024 20:04:03 +0000 Subject: [PATCH 5/9] Hotfix --- src/FancyButton.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FancyButton.ts b/src/FancyButton.ts index b379cd12..722fa1be 100644 --- a/src/FancyButton.ts +++ b/src/FancyButton.ts @@ -848,6 +848,7 @@ export class FancyButton extends ButtonContainer */ set textBaseScale(scale: Pos | number) { + if (!this.options) return; // Apply to the options so that the manual scale is prioritized. this.options.textScale = scale; if (scale === undefined) return; @@ -870,6 +871,7 @@ export class FancyButton extends ButtonContainer */ set iconBaseScale(scale: Pos | number) { + if (!this.options) return; // Apply to the options so that the manual scale is prioritized. this.options.iconScale = scale; if (scale === undefined) return; From a7e829767b2345e7987ba00774eea9a6e25b5a38 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:11:52 +0100 Subject: [PATCH 6/9] update --- src/FancyButton.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/FancyButton.ts b/src/FancyButton.ts index 722fa1be..ee9c758b 100644 --- a/src/FancyButton.ts +++ b/src/FancyButton.ts @@ -169,7 +169,7 @@ export class FancyButton extends ButtonContainer { super(); - this.options = options; + this.options = options ?? {}; const { defaultView, @@ -396,7 +396,7 @@ export class FancyButton extends ButtonContainer if (activeView) { - if (this.options && !this.options.ignoreRefitting) + if (!this.options?.ignoreRefitting) { this._views.textView.scale.set(this._textBaseScale.x, this._textBaseScale.y); } @@ -430,7 +430,7 @@ export class FancyButton extends ButtonContainer return; } - if (this.options && !this.options.ignoreRefitting) + if (!this.options?.ignoreRefitting) { this._views.iconView.scale.set(this._iconBaseScale.x, this._iconBaseScale.y); } @@ -848,10 +848,9 @@ export class FancyButton extends ButtonContainer */ set textBaseScale(scale: Pos | number) { - if (!this.options) return; + if (scale === undefined) return; // Apply to the options so that the manual scale is prioritized. this.options.textScale = scale; - if (scale === undefined) return; const isNumber = typeof scale === 'number'; this._textBaseScale.x = isNumber ? scale : scale.x ?? 1; @@ -871,10 +870,9 @@ export class FancyButton extends ButtonContainer */ set iconBaseScale(scale: Pos | number) { - if (!this.options) return; + if (scale === undefined) return; // Apply to the options so that the manual scale is prioritized. this.options.iconScale = scale; - if (scale === undefined) return; const isNumber = typeof scale === 'number'; this._iconBaseScale.x = isNumber ? scale : scale.x ?? 1; From 50bb1fc6f32aa66d506b8fc9b49a48971ee5be4f Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:16:59 +0100 Subject: [PATCH 7/9] update names --- src/FancyButton.ts | 54 ++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/FancyButton.ts b/src/FancyButton.ts index ee9c758b..da998dc4 100644 --- a/src/FancyButton.ts +++ b/src/FancyButton.ts @@ -61,8 +61,8 @@ export type ButtonOptions = ViewsInput & { offset?: Offset; textOffset?: Offset; iconOffset?: Offset; - textScale?: Pos | number; - iconScale?: Pos | number; + defaultTextScale?: Pos | number; + defaultIconScale?: Pos | number; animations?: StateAnimations; nineSliceSprite?: [number, number, number, number]; ignoreRefitting?: boolean; @@ -139,10 +139,10 @@ export class FancyButton extends ButtonContainer anchor: ObservablePoint; /** Base text scaling to take into account when fitting inside the button */ - protected _textBaseScale: Pos = { x: 1, y: 1 }; + protected _defaultTextScale: Pos = { x: 1, y: 1 }; /** Base icon scaling to take into account when fitting inside the button */ - protected _iconBaseScale: Pos = { x: 1, y: 1 }; + protected _defaultIconScale: Pos = { x: 1, y: 1 }; /** * Creates a button with a lot of tweaks. @@ -160,6 +160,8 @@ export class FancyButton extends ButtonContainer * @param {Point} options.iconOffset - Offset of the icon view. * @param {number} options.scale - Scale of the button. Scale will be applied to a main container, * when all animations scales will be applied to the inner view. + * @param {number} options.defaultTextScale - Base text scaling to take into account when fitting inside the button. + * @param {number} options.defaultIconScale - Base icon scaling to take into account when fitting inside the button. * @param {number} options.anchor - Anchor point of the button. * @param {number} options.anchorX - Horizontal anchor point of the button. * @param {number} options.anchorY - Vertical anchor point of the button. @@ -181,8 +183,8 @@ export class FancyButton extends ButtonContainer offset, textOffset, iconOffset, - textScale, - iconScale, + defaultTextScale: textScale, + defaultIconScale: iconScale, scale, anchor, anchorX, @@ -202,8 +204,8 @@ export class FancyButton extends ButtonContainer this.offset = offset; this.textOffset = textOffset; this.iconOffset = iconOffset; - this.textBaseScale = textScale; - this.iconBaseScale = iconScale; + this.defaultTextScale = textScale; + this.defaultIconScale = iconScale; this.scale.set(scale ?? 1); if (animations) @@ -314,11 +316,11 @@ export class FancyButton extends ButtonContainer this._views.textView = getTextView(text); // If text scale has not manually been set, we will overwrite the base scale with the new text view scale. - if (this.options?.textScale === undefined) + if (this.options?.defaultTextScale === undefined) { const { x, y } = this._views.textView.scale; - this._textBaseScale = { x, y }; + this._defaultTextScale = { x, y }; } this._views.textView.anchor.set(0); @@ -398,7 +400,7 @@ export class FancyButton extends ButtonContainer { if (!this.options?.ignoreRefitting) { - this._views.textView.scale.set(this._textBaseScale.x, this._textBaseScale.y); + this._views.textView.scale.set(this._defaultTextScale.x, this._defaultTextScale.y); } fitToView(activeView, this._views.textView, this.padding, false); @@ -432,7 +434,7 @@ export class FancyButton extends ButtonContainer if (!this.options?.ignoreRefitting) { - this._views.iconView.scale.set(this._iconBaseScale.x, this._iconBaseScale.y); + this._views.iconView.scale.set(this._defaultIconScale.x, this._defaultIconScale.y); } fitToView(activeView, this._views.iconView, this.padding, false); @@ -667,11 +669,11 @@ export class FancyButton extends ButtonContainer this._views.iconView = getView(view); // If icon scale has not manually been set, we will overwrite the base scale with the new icon view scale. - if (this.options?.iconScale === undefined) + if (this.options?.defaultIconScale === undefined) { const { x, y } = this._views.iconView.scale; - this._iconBaseScale = { x, y }; + this._defaultIconScale = { x, y }; } if (!this._views.iconView.parent) @@ -846,44 +848,44 @@ export class FancyButton extends ButtonContainer * Sets the base scale for the text view to take into account when fitting inside the button. * @param {Pos | number} scale - base scale of the text view. */ - set textBaseScale(scale: Pos | number) + set defaultTextScale(scale: Pos | number) { if (scale === undefined) return; // Apply to the options so that the manual scale is prioritized. - this.options.textScale = scale; + this.options.defaultTextScale = scale; const isNumber = typeof scale === 'number'; - this._textBaseScale.x = isNumber ? scale : scale.x ?? 1; - this._textBaseScale.y = isNumber ? scale : scale.y ?? 1; + this._defaultTextScale.x = isNumber ? scale : scale.x ?? 1; + this._defaultTextScale.y = isNumber ? scale : scale.y ?? 1; this.adjustTextView(this.state); } /** Returns the text view base scale. */ - get textBaseScale(): Pos + get defaultTextScale(): Pos { - return this.textBaseScale; + return this.defaultTextScale; } /** * Sets the base scale for the icon view to take into account when fitting inside the button. * @param {Pos | number} scale - base scale of the icon view. */ - set iconBaseScale(scale: Pos | number) + set defaultIconScale(scale: Pos | number) { if (scale === undefined) return; // Apply to the options so that the manual scale is prioritized. - this.options.iconScale = scale; + this.options.defaultIconScale = scale; const isNumber = typeof scale === 'number'; - this._iconBaseScale.x = isNumber ? scale : scale.x ?? 1; - this._iconBaseScale.y = isNumber ? scale : scale.y ?? 1; + this._defaultIconScale.x = isNumber ? scale : scale.x ?? 1; + this._defaultIconScale.y = isNumber ? scale : scale.y ?? 1; this.adjustIconView(this.state); } /** Returns the icon view base scale. */ - get iconBaseScale(): Pos + get defaultIconScale(): Pos { - return this.iconBaseScale; + return this.defaultIconScale; } /** From 5ac563a5568a8bc0a327236c1abfc27c961acf89 Mon Sep 17 00:00:00 2001 From: Baz Utsahajit Date: Fri, 5 Apr 2024 12:39:13 +0100 Subject: [PATCH 8/9] Expose default scale options on examples --- .../fancyButton/FancyButtonBitmapText.stories.ts | 16 +++++++++++++++- .../FancyButtonDynamicUpdate.stories.ts | 7 ++++++- .../fancyButton/FancyButtonGraphics.stories.ts | 6 ++++++ .../fancyButton/FancyButtonHTMLText.stories.ts | 16 +++++++++++++++- .../fancyButton/FancyButtonIcon.stories.ts | 3 +++ .../FancyButtonNineSliceSprite.stories.ts | 9 +++++++-- .../fancyButton/FancyButtonSprite.stories.ts | 3 +++ 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/stories/fancyButton/FancyButtonBitmapText.stories.ts b/src/stories/fancyButton/FancyButtonBitmapText.stories.ts index 60c7a089..9674bee4 100644 --- a/src/stories/fancyButton/FancyButtonBitmapText.stories.ts +++ b/src/stories/fancyButton/FancyButtonBitmapText.stories.ts @@ -13,6 +13,7 @@ const args = { padding: 11, textOffsetX: 0, textOffsetY: -7, + defaultTextScale: 0.99, anchorX: 0.5, anchorY: 0.5, animationDuration: 100, @@ -21,7 +22,19 @@ const args = { }; export const UsingSpriteAndBitmapText: StoryFn = ( - { text, textColor, disabled, onPress, padding, textOffsetX, textOffsetY, anchorX, anchorY, animationDuration }, + { + text, + textColor, + disabled, + onPress, + padding, + textOffsetX, + textOffsetY, + defaultTextScale, + anchorX, + anchorY, + animationDuration + }, context ) => new PixiStory({ @@ -60,6 +73,7 @@ export const UsingSpriteAndBitmapText: StoryFn = ( text: title, padding, textOffset: { x: textOffsetX, y: textOffsetY }, + defaultTextScale, animations: { hover: { props: { diff --git a/src/stories/fancyButton/FancyButtonDynamicUpdate.stories.ts b/src/stories/fancyButton/FancyButtonDynamicUpdate.stories.ts index d4428670..fea13287 100644 --- a/src/stories/fancyButton/FancyButtonDynamicUpdate.stories.ts +++ b/src/stories/fancyButton/FancyButtonDynamicUpdate.stories.ts @@ -11,6 +11,8 @@ import { action } from '@storybook/addon-actions'; const args = { text: 'Click me!', textColor: '#FFFFFF', + defaultTextScale: 0.99, + defaultIconScale: 0.2, padding: 11, anchorX: 0.5, anchorY: 0.5, @@ -21,6 +23,8 @@ const args = { export const DynamicUpdate: StoryFn = ({ text, textColor, + defaultTextScale, + defaultIconScale, disabled, onPress, padding, @@ -45,7 +49,7 @@ export const DynamicUpdate: StoryFn = ({ let icon = avatars[0]; button.iconView = Sprite.from(icon); - button.iconView.scale.set(0.2); + button.defaultIconScale = defaultIconScale; button.iconOffset = { x: -100, y: -7 }; button.textView = new Text({ @@ -54,6 +58,7 @@ export const DynamicUpdate: StoryFn = ({ fill: textColor || defaultTextStyle.fill } }); + button.defaultTextScale = defaultTextScale; button.textOffset = { x: 30, y: -7 }; button.padding = padding; diff --git a/src/stories/fancyButton/FancyButtonGraphics.stories.ts b/src/stories/fancyButton/FancyButtonGraphics.stories.ts index 31854828..8b67596b 100644 --- a/src/stories/fancyButton/FancyButtonGraphics.stories.ts +++ b/src/stories/fancyButton/FancyButtonGraphics.stories.ts @@ -24,6 +24,8 @@ const args = { iconOffsetY: -30, textOffsetX: 0, textOffsetY: 140, + defaultTextScale: 0.99, + defaultIconScale: 0.99, defaultOffsetY: 0, hoverOffsetY: -1, pressedOffsetY: 5, @@ -53,6 +55,8 @@ export const UseGraphics: StoryFn = ({ iconOffsetY, textOffsetX, textOffsetY, + defaultTextScale, + defaultIconScale, defaultOffsetY, hoverOffsetY, pressedOffsetY, @@ -107,6 +111,8 @@ export const UseGraphics: StoryFn = ({ x: iconOffsetX, y: iconOffsetY }, + defaultTextScale, + defaultIconScale, animations: { default: { props: { diff --git a/src/stories/fancyButton/FancyButtonHTMLText.stories.ts b/src/stories/fancyButton/FancyButtonHTMLText.stories.ts index 3a056217..b6674f3b 100644 --- a/src/stories/fancyButton/FancyButtonHTMLText.stories.ts +++ b/src/stories/fancyButton/FancyButtonHTMLText.stories.ts @@ -13,6 +13,7 @@ const args = { padding: 11, textOffsetX: 0, textOffsetY: -7, + defaultTextScale: 0.99, anchorX: 0.5, anchorY: 0.5, animationDuration: 100, @@ -21,7 +22,19 @@ const args = { }; export const UsingSpriteAndHTMLText: StoryFn = ( - { text, textColor, disabled, onPress, padding, textOffsetX, textOffsetY, anchorX, anchorY, animationDuration }, + { + text, + textColor, + disabled, + onPress, + padding, + textOffsetX, + textOffsetY, + defaultTextScale, + anchorX, + anchorY, + animationDuration + }, context, ) => new PixiStory({ @@ -54,6 +67,7 @@ export const UsingSpriteAndHTMLText: StoryFn = ( text: title, padding, textOffset: { x: textOffsetX, y: textOffsetY }, + defaultTextScale, animations: { hover: { props: { diff --git a/src/stories/fancyButton/FancyButtonIcon.stories.ts b/src/stories/fancyButton/FancyButtonIcon.stories.ts index d8f073ca..5c175a10 100644 --- a/src/stories/fancyButton/FancyButtonIcon.stories.ts +++ b/src/stories/fancyButton/FancyButtonIcon.stories.ts @@ -18,6 +18,7 @@ const args = { radius: 200, iconOffsetX: 0, iconOffsetY: 0, + defaultIconScale: 0.99, defaultOffset: 0, hoverOffset: -1, pressedOffset: 5, @@ -41,6 +42,7 @@ export const UseIcon: StoryFn = ({ padding, iconOffsetX, iconOffsetY, + defaultIconScale, defaultOffset, hoverOffset, pressedOffset, @@ -83,6 +85,7 @@ export const UseIcon: StoryFn = ({ x: iconOffsetX, y: iconOffsetY }, + defaultIconScale, animations: { hover: { props: { diff --git a/src/stories/fancyButton/FancyButtonNineSliceSprite.stories.ts b/src/stories/fancyButton/FancyButtonNineSliceSprite.stories.ts index b4cf3f0d..362158e2 100644 --- a/src/stories/fancyButton/FancyButtonNineSliceSprite.stories.ts +++ b/src/stories/fancyButton/FancyButtonNineSliceSprite.stories.ts @@ -14,6 +14,8 @@ const args = { padding: 11, width: 300, height: 137, + defaultTextScale: 0.99, + defaultIconScale: 0.2, anchorX: 0.5, anchorY: 0.5, animationDuration: 100, @@ -31,7 +33,9 @@ export const UseNineSliceSprite: StoryFn = ({ anchorY, animationDuration, width, - height + height, + defaultTextScale, + defaultIconScale, }, context) => new PixiStory({ context, @@ -65,6 +69,7 @@ export const UseNineSliceSprite: StoryFn = ({ }), padding, textOffset: { x: 30, y: -5 }, + defaultTextScale, animations: { hover: { props: { @@ -89,7 +94,7 @@ export const UseNineSliceSprite: StoryFn = ({ borderWidth: 10, borderColor: 0xFFFFFF }); - button.iconView.scale.set(0.2); + button.defaultIconScale = defaultIconScale; button.iconOffset = { x: -100, y: -7 }; button.anchor.set(anchorX, anchorY); diff --git a/src/stories/fancyButton/FancyButtonSprite.stories.ts b/src/stories/fancyButton/FancyButtonSprite.stories.ts index c75b9078..8cf14399 100644 --- a/src/stories/fancyButton/FancyButtonSprite.stories.ts +++ b/src/stories/fancyButton/FancyButtonSprite.stories.ts @@ -13,6 +13,7 @@ const args = { padding: 11, textOffsetX: 0, textOffsetY: -7, + defaultTextScale: 0.99, anchorX: 0.5, anchorY: 0.5, animationDuration: 100, @@ -28,6 +29,7 @@ export const UseSprite: StoryFn = ({ padding, textOffsetX, textOffsetY, + defaultTextScale, anchorX, anchorY, animationDuration @@ -54,6 +56,7 @@ export const UseSprite: StoryFn = ({ }), padding, textOffset: { x: textOffsetX, y: textOffsetY }, + defaultTextScale, animations: { hover: { props: { From 8d5b0018395fd735f4ec03162a993aaccaed7c8a Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:17:50 +0100 Subject: [PATCH 9/9] undo v7 changes --- .github/workflows/release.yml | 2 +- README.md | 2 +- package.json | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6424cdeb..2a61cba6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,6 @@ jobs: brew update brew install gh - name: Generate Release - run: gh release create ${{github.ref_name}} --generate-notes --draft + run: gh release create ${{github.ref_name}} --generate-notes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 497f09e1..5d14c148 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Here are some useful resources: Depending on your version of PixiJS, you'll need to figure out which major version of PixiUI to use. -| PixiJS | PixiJS UI | +| PixiJS | PixiUI | |-------------|----------------| | v7.x | v1.x | | v8.x | v2.x | diff --git a/package.json b/package.json index 78ba8b57..573c6c47 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "lint": "xs lint --max-warnings 0", "lint:fix": "xs lint --fix", "prepare": "husky install", - "release": "xs bump,build,docs && npm run release:dist && git-push", - "release:dist": "npm publish --tag latest-1.x", + "release": "xs bump,build,docs,publish,git-push", "serve": "xs serve", "storybook": "storybook dev -p 6006", "storybook:build": "storybook build --output-dir docs/storybook",