System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, size, view, screen, ResolutionPolicy, _dec, _class, _crd, ccclass, property, CHECK_INTERVAL, ResolutionAutoFit; return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; _decorator = _cc._decorator; Component = _cc.Component; size = _cc.size; view = _cc.view; screen = _cc.screen; ResolutionPolicy = _cc.ResolutionPolicy; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "c7d72SJqEtIhpLiAo3HdgLR", "ui_ResolutionAutoFit", undefined); __checkObsolete__(['_decorator', 'Component', 'Node', 'size', 'Size', 'view', 'screen', 'ResolutionPolicy']); ({ ccclass, property } = _decorator); CHECK_INTERVAL = 0.1; _export("ResolutionAutoFit", ResolutionAutoFit = (_dec = ccclass('ch.ResolutionAutoFit'), _dec(_class = class ResolutionAutoFit extends Component { constructor() { super(...arguments); this._oldSize = size(); this.lastCheckTime = 0; } start() { this.adjustResolutionPolicy(); } update(deltaTime) { this.lastCheckTime += deltaTime; if (this.lastCheckTime < CHECK_INTERVAL) { return; } this.lastCheckTime = 0; this.adjustResolutionPolicy(); } adjustResolutionPolicy() { var winSize = screen.windowSize; if (!this._oldSize.equals(winSize)) { var ratio = winSize.width / winSize.height; var drs = view.getDesignResolutionSize(); var drsRatio = drs.width / drs.height; if (ratio > drsRatio) { //wider than desgin. fixed height view.setResolutionPolicy(ResolutionPolicy.FIXED_HEIGHT); } else { // view.setResolutionPolicy(ResolutionPolicy.FIXED_WIDTH); } this._oldSize.set(winSize); } } }) || _class)); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=33d6d868e05219070a908e953bde210e54f92e26.js.map