(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/SubContextView.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '124c5NbJ4hHy7jsCaBjKWTz', 'SubContextView', __filename);
// Script/SubContextView.ts

Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var SubContextView = /** @class */ (function (_super) {
    __extends(SubContextView, _super);
    function SubContextView() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.texture = cc.Texture2D;
        _this.sprite = null;
        _this.subContextView = null;
        return _this;
    }
    SubContextView.prototype.onLoad = function () {
        this.texture = new cc.Texture2D();
        this.sprite = this.getComponent(cc.Sprite);
        this.subContextView = this.getComponent(cc.WXSubContextView);
    };
    SubContextView.prototype.update = function (dt) {
        if (cc.sys.platform == cc.sys.WECHAT_GAME) {
            var openDataContext = wx.getOpenDataContext();
            var sharedCanvas = openDataContext.canvas;
            this.texture.initWithElement(sharedCanvas);
            this.texture.handleLoadedTexture();
            this.sprite.spriteFrame = new cc.SpriteFrame(this.texture);
        }
        this.subContextView.updateSubContextViewport();
    };
    SubContextView = __decorate([
        ccclass
    ], SubContextView);
    return SubContextView;
}(cc.Component));
exports.default = SubContextView;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=SubContextView.js.map
        