@@ -62,7 +62,7 @@ const stylePropertyMap: {
6262
6363 return { prop : 'height' , value : `${ h } px` } ;
6464 } ,
65- zIndex : ( ) => 'zIndex ' ,
65+ zIndex : ( ) => 'z-index ' ,
6666 fontFamily : ( ) => 'font-family' ,
6767 fontSize : ( ) => 'font-size' ,
6868 fontStyle : ( ) => 'font-style' ,
@@ -239,6 +239,7 @@ export class Inspector {
239239 // really typescript? really?
240240 key as keyof CoreNodeProps ,
241241 properties [ key as keyof CoreNodeProps ] ,
242+ properties ,
242243 ) ;
243244 }
244245
@@ -247,8 +248,8 @@ export class Inspector {
247248
248249 createNode ( node : CoreNode ) : CoreNode {
249250 const div = this . createDiv ( node . id , node . props ) ;
250- ( div as any ) . node = node ;
251- ( node as any ) . div = div ;
251+ ( div as HTMLElement & { node : CoreNode } ) . node = node ;
252+ ( node as CoreNode & { div : HTMLElement } ) . div = div ;
252253
253254 node . on ( 'inViewport' , ( ) => div . setAttribute ( 'state' , 'inViewport' ) ) ;
254255 node . on ( 'inBounds' , ( ) => div . setAttribute ( 'state' , 'inBounds' ) ) ;
@@ -260,8 +261,8 @@ export class Inspector {
260261
261262 createTextNode ( node : CoreNode ) : CoreTextNode {
262263 const div = this . createDiv ( node . id , node . props ) ;
263- ( div as any ) . node = node ;
264- ( node as any ) . div = div ;
264+ ( div as HTMLElement & { node : CoreNode } ) . node = node ;
265+ ( node as CoreNode & { div : HTMLElement } ) . div = div ;
265266
266267 return this . createProxy ( node , div ) as CoreTextNode ;
267268 }
@@ -295,6 +296,7 @@ export class Inspector {
295296 div ,
296297 property as keyof CoreNodeProps | keyof CoreTextNodeProps ,
297298 value ,
299+ node . props ,
298300 ) ;
299301 } ,
300302 configurable : true ,
@@ -344,6 +346,7 @@ export class Inspector {
344346 property : keyof CoreNodeProps | keyof CoreTextNodeProps ,
345347 // eslint-disable-next-line @typescript-eslint/no-explicit-any
346348 value : any ,
349+ props : CoreNodeProps | CoreTextNodeProps ,
347350 ) {
348351 if ( this . root === null || value === undefined || value === null ) {
349352 return ;
@@ -407,10 +410,23 @@ export class Inspector {
407410 }
408411
409412 if ( typeof mappedStyleResponse === 'object' ) {
410- div . style . setProperty (
411- mappedStyleResponse . prop ,
412- mappedStyleResponse . value ,
413- ) ;
413+ let value = mappedStyleResponse . value ;
414+ if ( property === 'x' ) {
415+ const mount = props . mountX ;
416+ const width = props . width ;
417+
418+ if ( mount ) {
419+ value = `${ parseInt ( value ) - width * mount } px` ;
420+ }
421+ } else if ( property === 'y' ) {
422+ const mount = props . mountY ;
423+ const height = props . height ;
424+
425+ if ( mount ) {
426+ value = `${ parseInt ( value ) - height * mount } px` ;
427+ }
428+ }
429+ div . style . setProperty ( mappedStyleResponse . prop , value ) ;
414430 }
415431
416432 return ;
@@ -466,13 +482,15 @@ export class Inspector {
466482 rotation = 0 ,
467483 scale = 1 ,
468484 color,
485+ mountX,
486+ mountY,
469487 } = props ;
470488
471489 // ignoring loops and repeats for now, as that might be a bit too much for the inspector
472490 function animate ( ) {
473491 setTimeout ( ( ) => {
474- div . style . top = `${ y } px` ;
475- div . style . left = `${ x } px` ;
492+ div . style . top = `${ y - height * mountY } px` ;
493+ div . style . left = `${ x - width * mountX } px` ;
476494 div . style . width = `${ width } px` ;
477495 div . style . height = `${ height } px` ;
478496 div . style . opacity = `${ alpha } ` ;
0 commit comments