2012-07-04 13:08:59 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
2012-07-04 14:00:52 +08:00
|
|
|
// Global
|
2012-07-04 13:08:59 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
|
|
* Kinetic Namespace
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
var Kinetic = {};
|
2012-07-15 07:25:56 +08:00
|
|
|
Kinetic.Filters = {};
|
2012-07-28 10:51:18 +08:00
|
|
|
Kinetic.Plugins = {};
|
2012-07-04 13:08:59 +08:00
|
|
|
Kinetic.Global = {
|
2012-07-08 02:52:04 +08:00
|
|
|
BUBBLE_WHITELIST: ['mousedown', 'mousemove', 'mouseup', 'mouseover', 'mouseout', 'click', 'dblclick', 'touchstart', 'touchmove', 'touchend', 'tap', 'dbltap', 'dragstart', 'dragmove', 'dragend'],
|
2012-08-14 14:06:29 +08:00
|
|
|
BUFFER_WHITELIST: ['fill', 'stroke', 'textFill', 'textStroke'],
|
2012-08-19 13:02:16 +08:00
|
|
|
BUFFER_BLACKLIST: ['shadow'],
|
2012-07-04 13:08:59 +08:00
|
|
|
stages: [],
|
|
|
|
idCounter: 0,
|
2012-08-01 12:35:04 +08:00
|
|
|
tempNodes: {},
|
2012-08-11 13:33:22 +08:00
|
|
|
//shapes hash. rgb keys and shape values
|
|
|
|
shapes: {},
|
2012-07-04 13:08:59 +08:00
|
|
|
maxDragTimeInterval: 20,
|
|
|
|
drag: {
|
|
|
|
moving: false,
|
|
|
|
offset: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
},
|
|
|
|
lastDrawTime: 0
|
|
|
|
},
|
2012-07-17 15:32:26 +08:00
|
|
|
warn: function(str) {
|
|
|
|
if(console && console.warn) {
|
|
|
|
console.warn('Kinetic warning: ' + str);
|
|
|
|
}
|
|
|
|
},
|
2012-07-04 13:08:59 +08:00
|
|
|
_pullNodes: function(stage) {
|
|
|
|
var tempNodes = this.tempNodes;
|
2012-08-01 12:35:04 +08:00
|
|
|
for(var key in tempNodes) {
|
|
|
|
var node = tempNodes[key];
|
2012-07-04 13:08:59 +08:00
|
|
|
if(node.getStage() !== undefined && node.getStage()._id === stage._id) {
|
|
|
|
stage._addId(node);
|
|
|
|
stage._addName(node);
|
2012-08-01 12:35:04 +08:00
|
|
|
this._removeTempNode(node);
|
2012-07-04 13:08:59 +08:00
|
|
|
}
|
|
|
|
}
|
2012-08-01 12:35:04 +08:00
|
|
|
},
|
|
|
|
_addTempNode: function(node) {
|
|
|
|
this.tempNodes[node._id] = node;
|
|
|
|
},
|
|
|
|
_removeTempNode: function(node) {
|
|
|
|
delete this.tempNodes[node._id];
|
2012-07-04 13:08:59 +08:00
|
|
|
}
|
|
|
|
};
|