Commit b14a95c8 authored by wjf's avatar wjf

l

parent 0a7ac0b4
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "fyge-tbmini",
"version": "1.0.9",
"version": "1.1.1",
"description": "淘宝小程序canvas渲染引擎",
"main": "./build/fyge.min.js",
"types": "./build/FYGE.d.ts",
......
......@@ -396,11 +396,13 @@ export class DisplayObject extends EventDispatcher {
destroy() {
//移除所有监听
// this.removeAllEventListener();
super.destroy();
// super.destroy();
//如果有父级,从中移除自己
if (this.parent) {
this.parent.removeChild(this);
}
//在从父级移除自身后removeAllEventListener
super.destroy();
//矩阵销毁
this.transform.destroy();
//对应属性都置null
......@@ -417,6 +419,8 @@ export class DisplayObject extends EventDispatcher {
this.mouseEnable = false;
//标记为已销毁
this.destroyed = true;
}
get alpha(): number {
......
......@@ -205,10 +205,11 @@ export class EventDispatcher extends HashObject {
if (!event["_pd"]) {
if (listeners[i]) {
let listener = listeners[i];
let type = event.type;//防止call事件里触发其他事件导致event被修改;
listener.fn.call(listener.context, event)
//必须做单独指向,因为有可能出现上面的fn.里执行的就是removeEventListener,导致listeners[i]不存在
if (listener.once) {
s.removeEventListener(event.type, listener.fn, listener.context, useCapture);
s.removeEventListener(type/*event.type*/, listener.fn, listener.context, useCapture);
}
// listeners[i](event);
} else {
......
/**
* 创建一个离屏的canvas
*/
export function createCanvas(): HTMLCanvasElement {
//@ts-ignore
return document && document.createElement("canvas") || my._createOffscreenCanvas();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment