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YACV,IAAI,aAAa,EAAE;gBACf,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAC,EAAE,EAAC,CAAC,EAAC,IAAI,CAAC,CAAC;aAC9B;iBAAM;gBACH,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAC,EAAE,EAAC,GAAG,CAAC,CAAC;aAC3B;YACD,IAAI,uBAAU,CAAC,KAAK,EAAE;gBAClB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;aACrC;YACD,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACxB,CAAC;KACJ,CAAA;IAlDoB,oBAAoB;QADxC,OAAO;OACa,oBAAoB,CAkDxC;IAAD,2BAAC;KAAA;kBAlDoB,oBAAoB","file":"","sourceRoot":"/","sourcesContent":["import { GameConfig } from \"../../GameConfig\";\n\nconst { ccclass, property } = cc._decorator;\n\n@ccclass\nexport default class PortraitFixComponent extends cc.Component {\n\n onLoad() {\n\n }\n\n start() {\n\n }\n\n update(dt) {\n\n }\n\n /**屏幕适配 */\n fixScreenSize(isDatingScene: boolean) {\n let sprComp = this.node.getComponent(cc.Sprite);\n if (!sprComp) {\n cc.error(\"the PortraitFixComponent node has no cc.Sprite Component !\");\n return;\n }\n let spriteFrame = sprComp.spriteFrame;\n if(!spriteFrame){\n cc.warn(\"the cc.Sprite Component with empty spriteFrame data !\");\n return;\n }\n this.node.stopAllActions();\n let spriteFrameRect = spriteFrame.getRect();\n let screenSize = cc.winSize;\n let rW = screenSize.width / spriteFrameRect.width;\n let rH = screenSize.height / spriteFrameRect.height;\n if (GameConfig.debug) {\n // console.log(\"screenSize.width & spriteFrameRect.width\", screenSize.width + \", \" + spriteFrameRect.width);\n // console.log(\"screenSize.height & spriteFrameRect.height\", screenSize.height + \", \" + spriteFrameRect.height);\n // console.log(\"rW & rH\", rW + \", \" + rH);\n }\n if (rW >= 1 && rH >= 1) {\n return;\n }\n let s = 0;\n if (isDatingScene) {\n s = Math.min(rW,rH,1,0.73);\n } else {\n s = Math.min(rW,rH,0.7); \n }\n if (GameConfig.debug) {\n console.log(\"this.node.scale\", s);\n }\n this.node.scale = s;\n }\n}\n"]}