mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
removed instances of hit graph enable caching. Too complex and error prone at the moment
This commit is contained in:
@@ -310,24 +310,6 @@
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
_isListeningEnabled: function() {
|
|
||||||
var ret;
|
|
||||||
|
|
||||||
if (this._listeningEnabled) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = false;
|
|
||||||
this.children.each(function(child) {
|
|
||||||
if (child.isListeningEnabled()) {
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Kinetic.Util.extend(Kinetic.Container, Kinetic.Node);
|
Kinetic.Util.extend(Kinetic.Container, Kinetic.Node);
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ var Kinetic = {};
|
|||||||
traceArrMax: 100,
|
traceArrMax: 100,
|
||||||
dblClickWindow: 400,
|
dblClickWindow: 400,
|
||||||
pixelRatio: undefined,
|
pixelRatio: undefined,
|
||||||
enableHitGraph: true,
|
|
||||||
|
|
||||||
// user agent
|
// user agent
|
||||||
UA: (function() {
|
UA: (function() {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
this.attrs = {};
|
this.attrs = {};
|
||||||
this.cache = {};
|
this.cache = {};
|
||||||
this.setAttrs(config);
|
this.setAttrs(config);
|
||||||
//this._listeningEnabled = false;
|
|
||||||
|
|
||||||
// event bindings for cache handling
|
// event bindings for cache handling
|
||||||
this.on(TRANSFORM_CHANGE_STR, function() {
|
this.on(TRANSFORM_CHANGE_STR, function() {
|
||||||
@@ -418,13 +417,8 @@
|
|||||||
* @memberof Kinetic.Node.prototype
|
* @memberof Kinetic.Node.prototype
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
isListeningEnabled: function() {
|
|
||||||
return this._getCache(LISTENING_ENABLED, this._isListeningEnabled);
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
shouldDrawHit: function() {
|
shouldDrawHit: function() {
|
||||||
return Kinetic.enableHitGraph && /*this.isListeningEnabled() &&*/ this.isListening() && this.isVisible() && !Kinetic.isDragging();
|
return this.isListening() && this.isVisible() && !Kinetic.isDragging();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* determine if node is visible or not. Node is visible only
|
* determine if node is visible or not. Node is visible only
|
||||||
|
|||||||
@@ -296,11 +296,6 @@
|
|||||||
this.setDrawHitFunc(this.drawHitFunc);
|
this.setDrawHitFunc(this.drawHitFunc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
_isListeningEnabled: function() {
|
|
||||||
return this._listeningEnabled;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
Kinetic.Util.extend(Kinetic.Shape, Kinetic.Node);
|
Kinetic.Util.extend(Kinetic.Shape, Kinetic.Node);
|
||||||
|
|
||||||
|
|||||||
@@ -2620,7 +2620,7 @@ suite('Node', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test('Kinetic.enableHitGraph, listening, & shouldDrawHit', function(){
|
test('listening, & shouldDrawHit', function(){
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
|
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
@@ -2638,20 +2638,16 @@ suite('Node', function() {
|
|||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
|
|
||||||
// test enableHitGraph default
|
|
||||||
assert.equal(Kinetic.enableHitGraph, true);
|
|
||||||
|
|
||||||
assert.equal(rect.isListening(), true);
|
assert.equal(rect.isListening(), true);
|
||||||
assert.equal(rect.shouldDrawHit(), true);
|
assert.equal(rect.shouldDrawHit(), true);
|
||||||
|
|
||||||
// disable hit graph
|
rect.setListening(false);
|
||||||
Kinetic.enableHitGraph = false;
|
|
||||||
|
|
||||||
assert.equal(rect.isListening(), true);
|
|
||||||
|
assert.equal(rect.isListening(), false);
|
||||||
assert.equal(rect.shouldDrawHit(), false);
|
assert.equal(rect.shouldDrawHit(), false);
|
||||||
|
|
||||||
// set the flag back for future tests
|
|
||||||
Kinetic.enableHitGraph = true;
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user