pure-canvas
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -52,12 +52,21 @@ "use strict"; | ||
Stage.prototype.emitHitEvent = function (name, event) { | ||
var point = this.eventToElementCoordinate(event); | ||
var results = this.tree | ||
.search({ minX: point.x, minY: point.y, maxX: point.x, maxY: point.y }) | ||
.sort(function (a, b) { return b.zIndex - a.zIndex; }) | ||
.map(function (indexedNode) { | ||
var untransformedPoint = indexedNode.transformers.reduceRight(function (point, transformer) { return transformer.untransform(point); }, point); | ||
return indexedNode.node.intersection(untransformedPoint); | ||
}) | ||
.filter(Boolean); | ||
this.emit(name, results[0], event); | ||
var _this = this; | ||
var didSearch = false; | ||
var result = undefined; | ||
this.emit(name, function () { | ||
if (!didSearch) { | ||
var point_1 = _this.eventToElementCoordinate(event); | ||
var results = _this.tree | ||
.search({ minX: point_1.x, minY: point_1.y, maxX: point_1.x, maxY: point_1.y }) | ||
.sort(function (a, b) { return b.zIndex - a.zIndex; }) | ||
.map(function (indexedNode) { | ||
var untransformedPoint = indexedNode.transformers.reduceRight(function (point, transformer) { return transformer.untransform(point); }, point_1); | ||
return indexedNode.node.intersection(untransformedPoint); | ||
}) | ||
.filter(Boolean); | ||
result = results[0]; | ||
didSearch = true; | ||
} | ||
return result; | ||
}, event); | ||
}; | ||
@@ -64,0 +73,0 @@ Stage.prototype.render = function () { |
{ | ||
"name": "pure-canvas", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "TODO", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
143017
1562