Commit 1a619360 authored by rockyl's avatar rockyl

修复遮罩问题,修复点击区域重复的问题

parent 099fdbfe
......@@ -1508,12 +1508,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return this.$mask;
},
set: function (value) {
if (value === this) {
return;
}
if (this.$mask) {
this.$mask.renderable = true;
this.$mask.isUsedToMask = false;
if (this.$mask.parent) {
this.$mask.parent.removeChild(this.$mask);
}
}
this.$mask = value;
if (this.$mask) {
......@@ -1560,7 +1560,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}(EventDispatcher));
DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;
DisplayObject.prototype.displayObjectHitTestPoint = DisplayObject.prototype.hitTestPoint;
//# sourceMappingURL=DisplayObject.js.map
var GDispatcher = (function () {
function GDispatcher() {
......@@ -2026,6 +2025,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
//# sourceMappingURL=utils.js.map
function transPoint(str, sep) {
if (sep === void 0) { sep = ','; }
......@@ -2480,7 +2480,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var name = args[0];
var dataMapping = this.getDataMapping(name);
try {
var data = this.getDataByPath(dataMapping.path, undefined, true);
var data = this.getDataByPath(dataMapping.path, undefined, false);
if (args[1] !== undefined) {
data = data[args[1]];
}
......@@ -2858,7 +2858,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
props[key] = nameValue !== undefined ? nameValue : dataCenter.getDataByPath(name);
break;
case 'env':
props[key] = env[name];
props[key] = getDataByPath(env, name);
break;
case 'map':
this.updateProps(props[key] = {}, args, name, name);
......@@ -3415,8 +3415,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (isMouseEvent === void 0) { isMouseEvent = false; }
if (!this.visible)
return null;
var result = this.hitTestSelf(globalPoint);
if (isMouseEvent && !this.mouseChildren)
return this.hitTestSelf(globalPoint);
return result;
var children = this.children;
var length = children.length;
var child, hitDisplayObject;
......@@ -3440,11 +3441,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
Container.prototype.hitTestSelfBounds = function (globalPoint) {
if (this.width && this.height) {
var lp = this.globalToLocal(globalPoint, DisplayObject._bp);
if (lp.x > 0 &&
lp.x < this.width &&
lp.y > 0 &&
lp.y < this.height)
var _a = this.getBounds(), tx = _a.x, ty = _a.y;
var x = globalPoint.x, y = globalPoint.y;
if (x > tx &&
x < tx + this.width &&
y > ty &&
y < ty + this.height)
return this;
}
return null;
......@@ -7884,6 +7886,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
return requestAnimationFrame;
}());
var skipTagNames = ['INPUT'];
var Stage = (function (_super) {
tslib_1.__extends(Stage, _super);
function Stage(rootDivId, desW, desH, frameRate, scaleMode, renderType, transparent, bgColor) {
......@@ -8117,6 +8120,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
Stage.prototype.onMouseEvent = function (e) {
var s = this;
if (skipTagNames.indexOf(e.target.tagName) >= 0) {
return;
}
if (EventDispatcher._totalMEC > 0) {
var points = void 0;
var item = s._mouseEventTypes[e.type];
......@@ -16650,7 +16656,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
StackContainer.prototype.pop = function (dispatch) {
if (dispatch === void 0) { dispatch = true; }
var len = this.children.length;
if (len == 0) {
if (len <= 0) {
return false;
}
this.removeChildAt(len - 1);
......@@ -20118,6 +20124,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
value: (isArray ? curList[curIndex] : curList[curIndex].value),
writable: false
});
Object.defineProperty(newNode, "$data", {
configurable: true,
enumerable: false,
value: (isArray ? curList[curIndex] : curList[curIndex].value),
writable: false
});
context.compiler.compile(newNode, newScope);
lastNode = newNode;
}
......
This diff is collapsed.
{"id":"engine","url":"engine.7a271e32dee3c00329926f0b7096a1b62959bd5b.js"}
\ No newline at end of file
{"id":"engine","url":"engine.c62a7b1e88c4bcbbf86609a9b9fe3c2fd353dad2.js"}
\ No newline at end of file
......@@ -492,7 +492,8 @@ export default class Container extends DisplayObject {
//如果不可见
if (!this.visible) return null
//如果禁止子级的鼠标事件
if (isMouseEvent && !this.mouseChildren) return this.hitTestSelf(globalPoint);
let result = this.hitTestSelf(globalPoint);
if (isMouseEvent && !this.mouseChildren) return result;
var children = this.children;
var length = children.length;
let child, hitDisplayObject;
......@@ -521,11 +522,12 @@ export default class Container extends DisplayObject {
hitTestSelfBounds(globalPoint) {
if (this.width && this.height) {
let lp = this.globalToLocal(globalPoint, DisplayObject._bp);
if (lp.x > 0 &&
lp.x < this.width &&
lp.y > 0 &&
lp.y < this.height
let {x: tx, y: ty} = this.getBounds();
const {x, y} = globalPoint;
if (x > tx &&
x < tx + this.width &&
y > ty &&
y < ty + this.height
) return this;
}
return null
......
......@@ -609,14 +609,17 @@ export class DisplayObject extends EventDispatcher {
}
set mask(value) {
if(value === this){
return;
}
if (this.$mask) {
//原先有的遮罩,重置属性
this.$mask.renderable = true;
this.$mask.isUsedToMask = false;
if (this.$mask.parent) {
/*if (this.$mask.parent) {
this.$mask.parent.removeChild(this.$mask)
//是否销毁
}
}*/
}
this.$mask = value;
......
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