File tree Expand file tree Collapse file tree 3 files changed +33
-14
lines changed
packages/@lightningjs/ui-components/src/components Expand file tree Collapse file tree 3 files changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,10 @@ export default class InlineContent extends Base {
139139
140140 _notifyAncestors ( ) {
141141 this . fireAncestors ( '$loadedInlineContent' , this ) ;
142- this . signal ( 'loadedInlineContent' , this . finalW , this . multiLineHeight ) ;
142+ this . signal ( 'loadedInlineContent' , {
143+ w : this . finalW ,
144+ h : this . multiLineHeight
145+ } ) ;
143146 }
144147
145148 _contentLoaded ( ) {
Original file line number Diff line number Diff line change @@ -371,11 +371,10 @@ describe('InlineContent', () => {
371371 '$loadedInlineContent' ,
372372 inlineContent
373373 ) ;
374- expect ( inlineContent . signal ) . toHaveBeenCalledWith (
375- 'loadedInlineContent' ,
376- inlineContent . finalW ,
377- inlineContent . multiLineHeight
378- ) ;
374+ expect ( inlineContent . signal ) . toHaveBeenCalledWith ( 'loadedInlineContent' , {
375+ w : inlineContent . finalW ,
376+ h : inlineContent . multiLineHeight
377+ } ) ;
379378 } ) ;
380379
381380 it ( 'should truncate content that exceeds the defined max lines' , async ( ) => {
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export default class TextBox extends Base {
7171 ] ;
7272 }
7373
74- _setDimensions ( w , h ) {
74+ _setDimensions ( { w, h } ) {
7575 let width = w ;
7676 let height = h ;
7777 if ( ! this . _isInlineContent ) {
@@ -82,7 +82,8 @@ export default class TextBox extends Base {
8282 const sizeChanged = this . w !== width || this . h !== height ;
8383
8484 if ( width && height && sizeChanged ) {
85- this . h = height ;
85+ this . h =
86+ height * ( this . _isInlineContent ? 1 : this . stage . getRenderPrecision ( ) ) ;
8687 if ( ! this . fixed ) {
8788 this . w = width ;
8889 }
@@ -197,14 +198,30 @@ export default class TextBox extends Base {
197198 const fontStyle = this . _textStyleSet ;
198199
199200 if ( this . _Text ) {
200- this . _Text . patch ( {
201+ let patchObj = {
202+ w : w => w ,
201203 y : this . style . offsetY ,
202- x : this . style . offsetX ,
203- text : {
204- ...lightningTextDefaults , // order matters this should always be first
205- ...fontStyle
206- }
204+ x : this . style . offsetX
205+ } ;
206+
207+ const textString = JSON . stringify ( {
208+ ...lightningTextDefaults , // order matters this should always be first
209+ ...fontStyle
207210 } ) ;
211+
212+ if ( textString !== this . _textString ) {
213+ patchObj = {
214+ ...patchObj ,
215+
216+ text : {
217+ ...lightningTextDefaults , // order matters this should always be first
218+ ...fontStyle
219+ }
220+ } ;
221+ this . _textString = textString ;
222+ }
223+
224+ this . _Text . patch ( patchObj ) ;
208225 }
209226 }
210227
You can’t perform that action at this time.
0 commit comments