refactoring

This commit is contained in:
Anton Lavrenov
2019-02-23 20:54:20 -05:00
parent 3e7503ebdc
commit 98afa3fac6
16 changed files with 504 additions and 498 deletions

View File

@@ -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;
};