var t = require; var e = module; var i = exports; var s = (this && this.__decorate) || function(t, e, i, s) { var o, a = arguments.length, n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s); else for (var r = t.length - 1; 0 <= r; r--) (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n); return 3 < a && n && Object.defineProperty(e, i, n), n; }; Object.defineProperty(i, "__esModule", { value: !0 }); const { ccclass: o, property: a, executeInEditMode: n, menu: r } = cc._decorator; e = class extends cc.Component { constructor() { super(...arguments), (this._maxSize = 100); } set maxSize(t) { (this._maxSize = t), this.onSizeChange(); } get maxSize() { return this._maxSize; } onLoad() { this.node.on(cc.Node.EventType.SIZE_CHANGED, this.onSizeChange, this), this.onSizeChange(); } onSizeChange() { var t; this.node.width > this._maxSize || this.node.height > this._maxSize ? ((t = this.node.width > this.node.height ? this._maxSize / this.node.width : this._maxSize / this.node.height), (this.node.scale = t)) : (this.node.scale = 1); } }; s([a], e.prototype, "_maxSize", void 0), s([a({})], e.prototype, "maxSize", null), (e = s([o, n], e)), (i.default = e);