"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) { 
 function r() { 
 this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
Object.defineProperty(exports, "__esModule", { value: true });
var Panel_1 = require("../views/Panel");
var DogData_1 = require("../startScene/DogData");
var SharePanel = (function (_super) {
    __extends(SharePanel, _super);
    function SharePanel(data) {
        var _this = _super.call(this, data) || this;
        _this.mdata = data;
        return _this;
    }
    Object.defineProperty(SharePanel.prototype, "skinKey", {
        get: function () { return 'Share'; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SharePanel.prototype, "groupName", {
        get: function () { return 'share_panel'; },
        enumerable: true,
        configurable: true
    });
    SharePanel.prototype.start = function (data) {
        this.percentHeight = 100;
    };
    SharePanel.prototype.initEvents = function () {
        // this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.hidePanel, this);
    };
    SharePanel.prototype.removeEvents = function () {
        // this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.hidePanel, this);
    };
    SharePanel.prototype.onSkinComplete = function () {
        _super.prototype.onSkinComplete.call(this);
        this.once(egret.Event.ADDED_TO_STAGE, this.onLoad, this);
        if (this.stage) {
            this.onLoad();
        }
    };
    SharePanel.prototype.onLoad = function () {
        var _this = this;
        this.erweimaImg.visible = false;
        this.dogImg.source = 'dog_lv_' + (this.mdata.level) + '_png';
        this.dogImg.anchorOffsetX = DogData_1.default.getSizeData[this.mdata.level - 1][0] * 0.5;
        this.dogImg.anchorOffsetY = DogData_1.default.getSizeData[this.mdata.level - 1][1];
        this.dogImg.x = 750 * 0.5;
        this.dogImg.y = this.dogShadowImg.y;
        this.titleLb.text = '我在萌宠汪星球领养了' + this.mdata.dNum + '只狗狗';
        setTimeout(function () {
            _this.scanImg();
        }, 1000);
        //img.style.display = 'none';//block
    };
    SharePanel.prototype.scanImg = function () {
        var _this = this;
        var renderTexture = new egret.RenderTexture();
        renderTexture.drawToTexture(this.panelGroup, new egret.Rectangle(0, 0, 750, 1206));
        var imageData = renderTexture.toDataURL("image/png");
        var img = document.getElementById('shareImg');
        img.style.position = 'absolute';
        img['src'] = imageData;
        img.style.width = "100%"; //`${widthP}%`;
        img.style.left = "0%"; //`${leftP}%`;
        img.style.top = "0%"; //`${topP}%`;
        var sCloseBtn = document.getElementById('sCloseBtn');
        sCloseBtn.style.width = '50px';
        sCloseBtn.style.height = '50px';
        sCloseBtn.style.position = 'absolute';
        sCloseBtn.style.top = '40px';
        sCloseBtn.style.left = '40px';
        img.style.display = 'block';
        sCloseBtn.style.display = 'block';
        sCloseBtn.onclick = function () {
            img.style.display = 'none';
            sCloseBtn.style.display = 'none';
            _this.hidePanel();
        };
    };
    return SharePanel;
}(Panel_1.default));
exports.default = SharePanel;
__reflect(SharePanel.prototype, "\"c:/Users/duiba/Documents/kuwo/egret/src/sharePanel/SharePanel\".SharePanel");
//# sourceMappingURL=SharePanel.js.map