mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
fix method bad copy/paste error. fix #237
This commit is contained in:
parent
6783d174f2
commit
8397de488a
48
src/Node.js
48
src/Node.js
@ -795,11 +795,13 @@
|
|||||||
*/
|
*/
|
||||||
shouldDrawHit: function(canvas) {
|
shouldDrawHit: function(canvas) {
|
||||||
var layer = this.getLayer();
|
var layer = this.getLayer();
|
||||||
return (canvas && canvas.isCache) ||
|
return (
|
||||||
|
(canvas && canvas.isCache) ||
|
||||||
(layer &&
|
(layer &&
|
||||||
layer.hitGraphEnabled() &&
|
layer.hitGraphEnabled() &&
|
||||||
this.isListening() &&
|
this.isListening() &&
|
||||||
this.isVisible());
|
this.isVisible())
|
||||||
|
);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* show node
|
* show node
|
||||||
@ -1397,19 +1399,16 @@
|
|||||||
var at = new Konva.Transform(), transformsEnabled, trans;
|
var at = new Konva.Transform(), transformsEnabled, trans;
|
||||||
|
|
||||||
// start with stage and traverse downwards to self
|
// start with stage and traverse downwards to self
|
||||||
this._eachAncestorReverse(
|
this._eachAncestorReverse(function(node) {
|
||||||
function(node) {
|
transformsEnabled = node.transformsEnabled();
|
||||||
transformsEnabled = node.transformsEnabled();
|
trans = node.getTransform();
|
||||||
trans = node.getTransform();
|
|
||||||
|
|
||||||
if (transformsEnabled === 'all') {
|
if (transformsEnabled === 'all') {
|
||||||
at.multiply(trans);
|
at.multiply(trans);
|
||||||
} else if (transformsEnabled === 'position') {
|
} else if (transformsEnabled === 'position') {
|
||||||
at.translate(node.x(), node.y());
|
at.translate(node.x(), node.y());
|
||||||
}
|
}
|
||||||
},
|
}, top);
|
||||||
top
|
|
||||||
);
|
|
||||||
return at;
|
return at;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -1422,7 +1421,7 @@
|
|||||||
getAbsoluteScale: function(top) {
|
getAbsoluteScale: function(top) {
|
||||||
// if using an argument, we can't cache the result.
|
// if using an argument, we can't cache the result.
|
||||||
if (top) {
|
if (top) {
|
||||||
return this._getAbsoluteTransform(top);
|
return this._getAbsoluteScale(top);
|
||||||
} else {
|
} else {
|
||||||
// if no argument, we can cache the result
|
// if no argument, we can cache the result
|
||||||
return this._getCache(ABSOLUTE_SCALE, this._getAbsoluteScale);
|
return this._getCache(ABSOLUTE_SCALE, this._getAbsoluteScale);
|
||||||
@ -1441,13 +1440,10 @@
|
|||||||
var scaleX = 1, scaleY = 1;
|
var scaleX = 1, scaleY = 1;
|
||||||
|
|
||||||
// start with stage and traverse downwards to self
|
// start with stage and traverse downwards to self
|
||||||
this._eachAncestorReverse(
|
this._eachAncestorReverse(function(node) {
|
||||||
function(node) {
|
scaleX *= node.scaleX();
|
||||||
scaleX *= node.scaleX();
|
scaleY *= node.scaleY();
|
||||||
scaleY *= node.scaleY();
|
}, top);
|
||||||
},
|
|
||||||
top
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
x: scaleX,
|
x: scaleX,
|
||||||
y: scaleY
|
y: scaleY
|
||||||
@ -1487,7 +1483,7 @@
|
|||||||
m.scale(scaleX, scaleY);
|
m.scale(scaleX, scaleY);
|
||||||
}
|
}
|
||||||
if (offsetX !== 0 || offsetY !== 0) {
|
if (offsetX !== 0 || offsetY !== 0) {
|
||||||
m.translate((-1) * offsetX, (-1) * offsetY);
|
m.translate(-1 * offsetX, -1 * offsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
@ -1570,7 +1566,7 @@
|
|||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
if (x || y) {
|
if (x || y) {
|
||||||
context.translate((-1) * x, (-1) * y);
|
context.translate(-1 * x, -1 * y);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawScene(canvas);
|
this.drawScene(canvas);
|
||||||
@ -1891,8 +1887,8 @@
|
|||||||
this._fire(eventType, evt);
|
this._fire(eventType, evt);
|
||||||
|
|
||||||
// simulate event bubbling
|
// simulate event bubbling
|
||||||
var stopBubble = (eventType === MOUSEENTER ||
|
var stopBubble =
|
||||||
eventType === MOUSELEAVE) &&
|
(eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
|
||||||
(compareShape &&
|
(compareShape &&
|
||||||
compareShape.isAncestorOf &&
|
compareShape.isAncestorOf &&
|
||||||
compareShape.isAncestorOf(this) &&
|
compareShape.isAncestorOf(this) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user