mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
refactoring
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Konva JavaScript Framework v@@version
|
||||
* http://konvajs.github.io/
|
||||
* http://konvajs.org/
|
||||
* Licensed under the MIT
|
||||
* Date: @@date
|
||||
*
|
||||
@@ -15,9 +15,6 @@ var PI_OVER_180 = Math.PI / 180;
|
||||
*/
|
||||
export const version = '@@version';
|
||||
|
||||
export const names = {};
|
||||
export const shapes = {};
|
||||
|
||||
export const isBrowser =
|
||||
typeof window !== 'undefined' &&
|
||||
// browser case
|
||||
@@ -65,34 +62,6 @@ export const isDragReady = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
export const _addName = function(node: any, name) {
|
||||
if (name) {
|
||||
if (!names[name]) {
|
||||
names[name] = [];
|
||||
}
|
||||
names[name].push(node);
|
||||
}
|
||||
};
|
||||
|
||||
export const _removeName = function(name, _id) {
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
var nodes = names[name];
|
||||
if (!nodes) {
|
||||
return;
|
||||
}
|
||||
for (var n = 0; n < nodes.length; n++) {
|
||||
var no = nodes[n];
|
||||
if (no._id === _id) {
|
||||
nodes.splice(n, 1);
|
||||
}
|
||||
}
|
||||
if (nodes.length === 0) {
|
||||
delete names[name];
|
||||
}
|
||||
};
|
||||
|
||||
export const getAngle = function(angle) {
|
||||
return getGlobalKonva().angleDeg ? angle * PI_OVER_180 : angle;
|
||||
};
|
||||
|
Reference in New Issue
Block a user