@@ -563,7 +563,7 @@ export default class PixiStage {
563563 const targetHeight = originalHeight * targetScale ;
564564 thisFigureContainer . setBaseY ( this . stageHeight / 2 ) ;
565565 if ( targetHeight < this . stageHeight ) {
566- thisFigureContainer . setBaseY ( this . stageHeight / 2 + this . stageHeight - targetHeight / 2 ) ;
566+ thisFigureContainer . setBaseY ( this . stageHeight / 2 + ( this . stageHeight - targetHeight ) / 2 ) ;
567567 }
568568 if ( presetPosition === 'center' ) {
569569 thisFigureContainer . setBaseX ( this . stageWidth / 2 ) ;
@@ -627,8 +627,9 @@ export default class PixiStage {
627627 }
628628 // 挂载
629629 this . figureContainer . addChild ( thisFigureContainer ) ;
630+ const figureUuid = uuid ( ) ;
630631 this . figureObjects . push ( {
631- uuid : uuid ( ) ,
632+ uuid : figureUuid ,
632633 key : key ,
633634 pixiContainer : thisFigureContainer ,
634635 sourceUrl : jsonPath ,
@@ -639,7 +640,7 @@ export default class PixiStage {
639640 const instance = this ;
640641
641642 const setup = ( stage : PixiStage ) => {
642- if ( thisFigureContainer ) {
643+ if ( thisFigureContainer && this . getStageObjByUuid ( figureUuid ) ) {
643644 ( async function ( ) {
644645 let overrideBounds : [ number , number , number , number ] = [ 0 , 0 , 0 , 0 ] ;
645646 const mot = webgalStore . getState ( ) . stage . live2dMotion . find ( ( e ) => e . target === key ) ;
@@ -662,22 +663,29 @@ export default class PixiStage {
662663 models . forEach ( ( model ) => {
663664 const scaleX = stageWidth / model . width ;
664665 const scaleY = stageHeight / model . height ;
665- const targetScale = Math . min ( scaleX , scaleY ) * 1.5 ;
666+ const targetScale = Math . min ( scaleX , scaleY ) ;
666667 const targetWidth = model . width * targetScale ;
667- // const targetHeight = model.height * targetScale;
668-
669- model . scale . set ( targetScale ) ;
668+ const targetHeight = model . height * targetScale ;
669+ model . scale . x = targetScale ;
670+ model . scale . y = targetScale ;
670671 model . anchor . set ( 0.5 ) ;
671- model . position . x = stageWidth / 2 ;
672- model . position . y = stageHeight / 1. 2;
672+ model . position . x = 0 ;
673+ model . position . y = stageHeight / 2 ;
673674
674- if ( pos === 'left' ) {
675- model . position . x = targetWidth / 2 ;
675+ let baseY = stageHeight / 2 ;
676+ if ( targetHeight < stageHeight ) {
677+ baseY = stageHeight / 2 + ( stageHeight - targetHeight ) / 2 ;
676678 }
677- if ( pos === 'right' ) {
678- model . position . x = stageWidth - targetWidth / 2 ;
679+ thisFigureContainer . setBaseY ( baseY ) ;
680+ if ( pos === 'center' ) {
681+ thisFigureContainer . setBaseX ( stageWidth / 2 ) ;
682+ } else if ( pos === 'left' ) {
683+ thisFigureContainer . setBaseX ( targetWidth / 2 ) ;
684+ } else if ( pos === 'right' ) {
685+ thisFigureContainer . setBaseX ( stageWidth - targetWidth / 2 ) ;
679686 }
680687
688+ thisFigureContainer . pivot . set ( 0 , stageHeight / 2 ) ;
681689 let motionToSet = motion ;
682690 let animation_index = 0 ;
683691 let priority_number = 3 ;
0 commit comments