mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Automatic validations for many attributes. close #436
This commit is contained in:
parent
973e7932e4
commit
738cc8b79c
@ -8,7 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Default duration for tweens and `node.to()` methods is now 300ms
|
* Default duration for tweens and `node.to()` methods is now 300ms
|
||||||
|
* Typescript fixes
|
||||||
|
* Automatic validations for many attributes
|
||||||
|
|
||||||
## [2.2.1][2018-08-10]
|
## [2.2.1][2018-08-10]
|
||||||
|
|
||||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -597,7 +597,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Container, 'clipX');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Container,
|
||||||
|
'clipX',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set clip x
|
* get/set clip x
|
||||||
* @name clipX
|
* @name clipX
|
||||||
@ -613,7 +618,12 @@
|
|||||||
* container.clipX(10);
|
* container.clipX(10);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Container, 'clipY');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Container,
|
||||||
|
'clipY',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set clip y
|
* get/set clip y
|
||||||
* @name clipY
|
* @name clipY
|
||||||
@ -629,7 +639,12 @@
|
|||||||
* container.clipY(10);
|
* container.clipY(10);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Container, 'clipWidth');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Container,
|
||||||
|
'clipWidth',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set clip width
|
* get/set clip width
|
||||||
* @name clipWidth
|
* @name clipWidth
|
||||||
@ -645,7 +660,12 @@
|
|||||||
* container.clipWidth(100);
|
* container.clipWidth(100);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Container, 'clipHeight');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Container,
|
||||||
|
'clipHeight',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set clip height
|
* get/set clip height
|
||||||
* @name clipHeight
|
* @name clipHeight
|
||||||
|
113
src/Factory.js
113
src/Factory.js
@ -19,11 +19,14 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
addSetter: function(constructor, attr, validator, after) {
|
addSetter: function(constructor, attr, validator, after) {
|
||||||
|
// if (!validator && validator !== null) {
|
||||||
|
// console.error(constructor, attr, 'has no validator.');
|
||||||
|
// }
|
||||||
var method = SET + Konva.Util._capitalize(attr);
|
var method = SET + Konva.Util._capitalize(attr);
|
||||||
|
|
||||||
constructor.prototype[method] = function(val) {
|
constructor.prototype[method] = function(val) {
|
||||||
if (validator) {
|
if (validator && val !== undefined && val !== null) {
|
||||||
val = validator.call(this, val);
|
val = validator.call(this, val, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setAttr(attr, val);
|
this._setAttr(attr, val);
|
||||||
@ -169,6 +172,112 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
},
|
||||||
|
_formatValue: function(val) {
|
||||||
|
if (Konva.Util._isString(val)) {
|
||||||
|
return '"' + val + '"';
|
||||||
|
}
|
||||||
|
if (Object.prototype.toString.call(val) === '[object Number]') {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
if (Konva.Util._isBoolean(val)) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
return Object.prototype.toString.call(val);
|
||||||
|
},
|
||||||
|
getNumberValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
if (!Konva.Util._isNumber(val)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a number.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getNumberOrAutoValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
var isNumber = Konva.Util._isNumber(val);
|
||||||
|
var isAuto = val === 'auto';
|
||||||
|
|
||||||
|
if (!(isNumber || isAuto)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a number or "auto".'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getStringValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
if (!Konva.Util._isString(val)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a string.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getFunctionValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
if (!Konva.Util._isFunction(val)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a function.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getNumberArrayValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
if (!Konva.Util._isArray(val)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a array of numbers.'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
val.forEach(function(item) {
|
||||||
|
if (!Konva.Util._isNumber(item)) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
'"' +
|
||||||
|
attr +
|
||||||
|
'" attribute has non numeric element ' +
|
||||||
|
item +
|
||||||
|
'. Make sure that all elements are numbers.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getBooleanValidator: function() {
|
||||||
|
return function(val, attr) {
|
||||||
|
var isBool = val === true || val === false;
|
||||||
|
if (!isBool) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
Konva.Validators._formatValue(val) +
|
||||||
|
' is a not valid value for "' +
|
||||||
|
attr +
|
||||||
|
'" attribute. The value should be a boolean.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
135
src/Node.js
135
src/Node.js
@ -2049,7 +2049,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'x', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'x',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set x position
|
* get/set x position
|
||||||
@ -2066,7 +2071,12 @@
|
|||||||
* node.x(5);
|
* node.x(5);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'y', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'y',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set y position
|
* get/set y position
|
||||||
@ -2086,7 +2096,8 @@
|
|||||||
Konva.Factory.addGetterSetter(
|
Konva.Factory.addGetterSetter(
|
||||||
Konva.Node,
|
Konva.Node,
|
||||||
'globalCompositeOperation',
|
'globalCompositeOperation',
|
||||||
'source-over'
|
'source-over',
|
||||||
|
Konva.Validators.getStringValidator()
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2103,7 +2114,12 @@
|
|||||||
* // set globalCompositeOperation
|
* // set globalCompositeOperation
|
||||||
* shape.globalCompositeOperation('source-in');
|
* shape.globalCompositeOperation('source-in');
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'opacity', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'opacity',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set opacity. Opacity values range from 0 to 1.
|
* get/set opacity. Opacity values range from 0 to 1.
|
||||||
@ -2161,7 +2177,12 @@
|
|||||||
* node.id('foo');
|
* node.id('foo');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'rotation', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'rotation',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set rotation in degrees
|
* get/set rotation in degrees
|
||||||
@ -2200,7 +2221,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'scaleX', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'scaleX',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set scale x
|
* get/set scale x
|
||||||
@ -2217,7 +2243,12 @@
|
|||||||
* node.scaleX(2);
|
* node.scaleX(2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'scaleY', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'scaleY',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set scale y
|
* get/set scale y
|
||||||
@ -2256,7 +2287,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'skewX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'skewX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set skew x
|
* get/set skew x
|
||||||
@ -2273,7 +2309,12 @@
|
|||||||
* node.skewX(3);
|
* node.skewX(3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'skewY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'skewY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set skew y
|
* get/set skew y
|
||||||
@ -2311,7 +2352,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'offsetX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'offsetX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set offset x
|
* get/set offset x
|
||||||
@ -2328,7 +2374,12 @@
|
|||||||
* node.offsetX(3);
|
* node.offsetX(3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'offsetY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'offsetY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set offset y
|
* get/set offset y
|
||||||
@ -2345,7 +2396,11 @@
|
|||||||
* node.offsetY(3);
|
* node.offsetY(3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addSetter(Konva.Node, 'dragDistance');
|
Konva.Factory.addSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'dragDistance',
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'dragDistance');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'dragDistance');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2366,7 +2421,11 @@
|
|||||||
* Konva.dragDistance = 3;
|
* Konva.dragDistance = 3;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addSetter(Konva.Node, 'width', 0);
|
Konva.Factory.addSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'width',
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'width');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'width');
|
||||||
/**
|
/**
|
||||||
* get/set width
|
* get/set width
|
||||||
@ -2383,7 +2442,11 @@
|
|||||||
* node.width(100);
|
* node.width(100);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addSetter(Konva.Node, 'height', 0);
|
Konva.Factory.addSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'height',
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'height');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Node, 'height');
|
||||||
/**
|
/**
|
||||||
* get/set height
|
* get/set height
|
||||||
@ -2400,7 +2463,18 @@
|
|||||||
* node.height(100);
|
* node.height(100);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'listening', 'inherit');
|
Konva.Factory.addGetterSetter(Konva.Node, 'listening', 'inherit', function(
|
||||||
|
val
|
||||||
|
) {
|
||||||
|
var isValid = val === true || val === false || val === 'inherit';
|
||||||
|
if (!isValid) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
val +
|
||||||
|
' is a not valid value for "listening" attribute. The value may be true, false or "inherit".'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* get/set listenig attr. If you need to determine if a node is listening or not
|
* get/set listenig attr. If you need to determine if a node is listening or not
|
||||||
* by taking into account its parents, use the isListening() method
|
* by taking into account its parents, use the isListening() method
|
||||||
@ -2443,11 +2517,14 @@
|
|||||||
* shape.preventDefault(false);
|
* shape.preventDefault(false);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'preventDefault', true);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'preventDefault',
|
||||||
|
true,
|
||||||
|
Konva.Validators.getBooleanValidator()
|
||||||
|
);
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'filters', undefined, function(
|
Konva.Factory.addGetterSetter(Konva.Node, 'filters', null, function(val) {
|
||||||
val
|
|
||||||
) {
|
|
||||||
this._filterUpToDate = false;
|
this._filterUpToDate = false;
|
||||||
return val;
|
return val;
|
||||||
});
|
});
|
||||||
@ -2475,7 +2552,18 @@
|
|||||||
* ]);
|
* ]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'visible', 'inherit');
|
Konva.Factory.addGetterSetter(Konva.Node, 'visible', 'inherit', function(
|
||||||
|
val
|
||||||
|
) {
|
||||||
|
var isValid = val === true || val === false || val === 'inherit';
|
||||||
|
if (!isValid) {
|
||||||
|
Konva.Util.warn(
|
||||||
|
val +
|
||||||
|
' is a not valid value for "visible" attribute. The value may be true, false or "inherit".'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* get/set visible attr. Can be "inherit", true, or false. The default is "inherit".
|
* get/set visible attr. Can be "inherit", true, or false. The default is "inherit".
|
||||||
* If you need to determine if a node is visible or not
|
* If you need to determine if a node is visible or not
|
||||||
@ -2499,7 +2587,12 @@
|
|||||||
* node.visible('inherit');
|
* node.visible('inherit');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Node, 'transformsEnabled', 'all');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'transformsEnabled',
|
||||||
|
'all',
|
||||||
|
Konva.Validators.getStringValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set transforms that are enabled. Can be "all", "none", or "position". The default
|
* get/set transforms that are enabled. Can be "all", "none", or "position". The default
|
||||||
|
126
src/Shape.js
126
src/Shape.js
@ -519,7 +519,12 @@
|
|||||||
Konva.Util.extend(Konva.Shape, Konva.Node);
|
Konva.Util.extend(Konva.Shape, Konva.Node);
|
||||||
|
|
||||||
// add getters and setters
|
// add getters and setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'stroke');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'stroke',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getStringValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set stroke color
|
* get/set stroke color
|
||||||
@ -545,7 +550,12 @@
|
|||||||
* shape.stroke('rgba(0,255,0,0.5');
|
* shape.stroke('rgba(0,255,0,0.5');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeWidth', 2);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'strokeWidth',
|
||||||
|
2,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set stroke width
|
* get/set stroke width
|
||||||
@ -562,7 +572,12 @@
|
|||||||
* shape.strokeWidth();
|
* shape.strokeWidth();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeHitEnabled', true);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'strokeHitEnabled',
|
||||||
|
true,
|
||||||
|
Konva.Validators.getBooleanValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set strokeHitEnabled property. Useful for performance optimization.
|
* get/set strokeHitEnabled property. Useful for performance optimization.
|
||||||
@ -583,7 +598,12 @@
|
|||||||
* shape.strokeHitEnabled();
|
* shape.strokeHitEnabled();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'perfectDrawEnabled', true);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'perfectDrawEnabled',
|
||||||
|
true,
|
||||||
|
Konva.Validators.getBooleanValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set perfectDrawEnabled. If a shape has fill, stroke and opacity you may set `perfectDrawEnabled` to false to improve performance.
|
* get/set perfectDrawEnabled. If a shape has fill, stroke and opacity you may set `perfectDrawEnabled` to false to improve performance.
|
||||||
@ -602,7 +622,12 @@
|
|||||||
* shape.perfectDrawEnabled();
|
* shape.perfectDrawEnabled();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowForStrokeEnabled', true);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowForStrokeEnabled',
|
||||||
|
true,
|
||||||
|
Konva.Validators.getBooleanValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadowForStrokeEnabled. Useful for performance optimization.
|
* get/set shadowForStrokeEnabled. Useful for performance optimization.
|
||||||
@ -719,7 +744,12 @@
|
|||||||
* line.dash([10, 20, 0.001, 20]);
|
* line.dash([10, 20, 0.001, 20]);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'dashOffset', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'dashOffset',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set dash offset for stroke.
|
* get/set dash offset for stroke.
|
||||||
@ -734,7 +764,12 @@
|
|||||||
* line.dashOffset(5);
|
* line.dashOffset(5);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowColor');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowColor',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getStringValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadow color
|
* get/set shadow color
|
||||||
@ -760,7 +795,12 @@
|
|||||||
* shape.shadowColor('rgba(0,255,0,0.5');
|
* shape.shadowColor('rgba(0,255,0,0.5');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowBlur');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowBlur',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadow blur
|
* get/set shadow blur
|
||||||
@ -777,7 +817,12 @@
|
|||||||
* shape.shadowBlur(10);
|
* shape.shadowBlur(10);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowOpacity');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowOpacity',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadow opacity. must be a value between 0 and 1
|
* get/set shadow opacity. must be a value between 0 and 1
|
||||||
@ -819,7 +864,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowOffsetX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowOffsetX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadow offset x
|
* get/set shadow offset x
|
||||||
@ -836,7 +886,12 @@
|
|||||||
* shape.shadowOffsetX(5);
|
* shape.shadowOffsetX(5);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowOffsetY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'shadowOffsetY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set shadow offset y
|
* get/set shadow offset y
|
||||||
@ -874,7 +929,12 @@
|
|||||||
* imageObj.src = 'path/to/image/jpg';
|
* imageObj.src = 'path/to/image/jpg';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fill');
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fill',
|
||||||
|
undefined,
|
||||||
|
Konva.Validators.getStringValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill color
|
* get/set fill color
|
||||||
@ -903,7 +963,12 @@
|
|||||||
* shape.fill(null);
|
* shape.fill(null);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern x
|
* get/set fill pattern x
|
||||||
@ -919,7 +984,12 @@
|
|||||||
* shape.fillPatternX(20);
|
* shape.fillPatternX(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern y
|
* get/set fill pattern y
|
||||||
@ -1190,7 +1260,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternOffsetX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternOffsetX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern offset x
|
* get/set fill pattern offset x
|
||||||
@ -1207,7 +1282,12 @@
|
|||||||
* shape.fillPatternOffsetX(20);
|
* shape.fillPatternOffsetX(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternOffsetY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternOffsetY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern offset y
|
* get/set fill pattern offset y
|
||||||
@ -1249,7 +1329,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternScaleX', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternScaleX',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern scale x
|
* get/set fill pattern scale x
|
||||||
@ -1266,7 +1351,12 @@
|
|||||||
* shape.fillPatternScaleX(2);
|
* shape.fillPatternScaleX(2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternScaleY', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Shape,
|
||||||
|
'fillPatternScaleY',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set fill pattern scale y
|
* get/set fill pattern scale y
|
||||||
|
10
src/Util.js
10
src/Util.js
@ -303,6 +303,7 @@
|
|||||||
OBJECT_ARRAY = '[object Array]',
|
OBJECT_ARRAY = '[object Array]',
|
||||||
OBJECT_NUMBER = '[object Number]',
|
OBJECT_NUMBER = '[object Number]',
|
||||||
OBJECT_STRING = '[object String]',
|
OBJECT_STRING = '[object String]',
|
||||||
|
OBJECT_BOOLEAN = '[object Boolean]',
|
||||||
PI_OVER_DEG180 = Math.PI / 180,
|
PI_OVER_DEG180 = Math.PI / 180,
|
||||||
DEG180_OVER_PI = 180 / Math.PI,
|
DEG180_OVER_PI = 180 / Math.PI,
|
||||||
HASH = '#',
|
HASH = '#',
|
||||||
@ -485,11 +486,18 @@
|
|||||||
return Object.prototype.toString.call(obj) === OBJECT_ARRAY;
|
return Object.prototype.toString.call(obj) === OBJECT_ARRAY;
|
||||||
},
|
},
|
||||||
_isNumber: function(obj) {
|
_isNumber: function(obj) {
|
||||||
return Object.prototype.toString.call(obj) === OBJECT_NUMBER;
|
return (
|
||||||
|
Object.prototype.toString.call(obj) === OBJECT_NUMBER &&
|
||||||
|
!isNaN(obj) &&
|
||||||
|
isFinite(obj)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
_isString: function(obj) {
|
_isString: function(obj) {
|
||||||
return Object.prototype.toString.call(obj) === OBJECT_STRING;
|
return Object.prototype.toString.call(obj) === OBJECT_STRING;
|
||||||
},
|
},
|
||||||
|
_isBoolean: function(obj) {
|
||||||
|
return Object.prototype.toString.call(obj) === OBJECT_BOOLEAN;
|
||||||
|
},
|
||||||
// arrays are objects too
|
// arrays are objects too
|
||||||
isObject: function(val) {
|
isObject: function(val) {
|
||||||
return val instanceof Object;
|
return val instanceof Object;
|
||||||
|
@ -839,7 +839,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'blurRadius',
|
'blurRadius',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'brightness',
|
'brightness',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'contrast',
|
'contrast',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
})(Konva);
|
})(Konva);
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'embossStrength',
|
'embossStrength',
|
||||||
0.5,
|
0.5,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -158,7 +158,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'embossWhiteLevel',
|
'embossWhiteLevel',
|
||||||
0.5,
|
0.5,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +146,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'enhance',
|
'enhance',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'hue',
|
'hue',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -20,7 +20,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'saturation',
|
'saturation',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -36,7 +36,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'luminance',
|
'luminance',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'hue',
|
'hue',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -80,7 +80,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'saturation',
|
'saturation',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -96,7 +96,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'value',
|
'value',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -274,7 +274,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'kaleidoscopePower',
|
'kaleidoscopePower',
|
||||||
2,
|
2,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -290,7 +290,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'kaleidoscopeAngle',
|
'kaleidoscopeAngle',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'threshold',
|
'threshold',
|
||||||
0,
|
0,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'noise',
|
'noise',
|
||||||
0.2,
|
0.2,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'pixelSize',
|
'pixelSize',
|
||||||
8,
|
8,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'levels',
|
'levels',
|
||||||
0.5,
|
0.5,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
Konva.Node,
|
Konva.Node,
|
||||||
'threshold',
|
'threshold',
|
||||||
0.5,
|
0.5,
|
||||||
null,
|
Konva.Validators.getNumberValidator(),
|
||||||
Konva.Factory.afterSetFilter
|
Konva.Factory.afterSetFilter
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +71,12 @@
|
|||||||
Konva.Util.extend(Konva.Arc, Konva.Shape);
|
Konva.Util.extend(Konva.Arc, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Arc, 'innerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Arc,
|
||||||
|
'innerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set innerRadius
|
* get/set innerRadius
|
||||||
@ -88,7 +93,12 @@
|
|||||||
* arc.innerRadius(20);
|
* arc.innerRadius(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Arc, 'outerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Arc,
|
||||||
|
'outerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set outerRadius
|
* get/set outerRadius
|
||||||
@ -105,7 +115,12 @@
|
|||||||
* arc.outerRadius(20);
|
* arc.outerRadius(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Arc, 'angle', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Arc,
|
||||||
|
'angle',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set angle in degrees
|
* get/set angle in degrees
|
||||||
|
@ -125,7 +125,12 @@
|
|||||||
* line.pointerLength(15);
|
* line.pointerLength(15);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Arrow, 'pointerLength', 10);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Arrow,
|
||||||
|
'pointerLength',
|
||||||
|
10,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set pointerWidth
|
* get/set pointerWidth
|
||||||
* @name pointerWidth
|
* @name pointerWidth
|
||||||
@ -142,7 +147,12 @@
|
|||||||
* line.pointerWidth(15);
|
* line.pointerWidth(15);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Arrow, 'pointerWidth', 10);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Arrow,
|
||||||
|
'pointerWidth',
|
||||||
|
10,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set pointerAtBeginning
|
* get/set pointerAtBeginning
|
||||||
* @name pointerAtBeginning
|
* @name pointerAtBeginning
|
||||||
|
@ -66,7 +66,12 @@
|
|||||||
Konva.Util.extend(Konva.Circle, Konva.Shape);
|
Konva.Util.extend(Konva.Circle, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Circle, 'radius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Circle,
|
||||||
|
'radius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Circle, 'radius');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Circle, 'radius');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,7 +95,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Ellipse, 'radiusX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Ellipse,
|
||||||
|
'radiusX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set radius x
|
* get/set radius x
|
||||||
* @name radiusX
|
* @name radiusX
|
||||||
@ -111,7 +116,12 @@
|
|||||||
* ellipse.radiusX(200);
|
* ellipse.radiusX(200);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Ellipse, 'radiusY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Ellipse,
|
||||||
|
'radiusY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set radius y
|
* get/set radius y
|
||||||
* @name radiusY
|
* @name radiusY
|
||||||
|
@ -153,7 +153,12 @@
|
|||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Image, 'cropX', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Image,
|
||||||
|
'cropX',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set crop x
|
* get/set crop x
|
||||||
* @method
|
* @method
|
||||||
@ -169,7 +174,12 @@
|
|||||||
* image.cropX(20);
|
* image.cropX(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Image, 'cropY', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Image,
|
||||||
|
'cropY',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set crop y
|
* get/set crop y
|
||||||
* @name cropY
|
* @name cropY
|
||||||
@ -185,7 +195,12 @@
|
|||||||
* image.cropY(20);
|
* image.cropY(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Image, 'cropWidth', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Image,
|
||||||
|
'cropWidth',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set crop width
|
* get/set crop width
|
||||||
* @name cropWidth
|
* @name cropWidth
|
||||||
@ -201,7 +216,12 @@
|
|||||||
* image.cropWidth(20);
|
* image.cropWidth(20);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Image, 'cropHeight', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Image,
|
||||||
|
'cropHeight',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set crop height
|
* get/set crop height
|
||||||
* @name cropHeight
|
* @name cropHeight
|
||||||
|
@ -337,7 +337,12 @@
|
|||||||
* @memberof Konva.Tag.prototype
|
* @memberof Konva.Tag.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Tag, 'pointerWidth', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Tag,
|
||||||
|
'pointerWidth',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set pointer width
|
* set pointer width
|
||||||
@ -354,7 +359,12 @@
|
|||||||
* @memberof Konva.Tag.prototype
|
* @memberof Konva.Tag.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Tag, 'pointerHeight', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Tag,
|
||||||
|
'pointerHeight',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set pointer height
|
* set pointer height
|
||||||
@ -371,7 +381,12 @@
|
|||||||
* @memberof Konva.Tag.prototype
|
* @memberof Konva.Tag.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Tag, 'cornerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Tag,
|
||||||
|
'cornerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set corner radius
|
* set corner radius
|
||||||
|
@ -244,7 +244,12 @@
|
|||||||
* line.bezier(true);
|
* line.bezier(true);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Line, 'tension', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Line,
|
||||||
|
'tension',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set tension
|
* get/set tension
|
||||||
@ -262,7 +267,12 @@
|
|||||||
* line.tension(3);
|
* line.tension(3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Line, 'points', []);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Line,
|
||||||
|
'points',
|
||||||
|
[],
|
||||||
|
Konva.Validators.getNumberArrayValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set points array
|
* get/set points array
|
||||||
* @name points
|
* @name points
|
||||||
|
@ -86,7 +86,12 @@
|
|||||||
|
|
||||||
Konva.Util.extend(Konva.Rect, Konva.Shape);
|
Konva.Util.extend(Konva.Rect, Konva.Shape);
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Rect, 'cornerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Rect,
|
||||||
|
'cornerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* get/set corner radius
|
* get/set corner radius
|
||||||
* @name cornerRadius
|
* @name cornerRadius
|
||||||
|
@ -76,7 +76,12 @@
|
|||||||
Konva.Util.extend(Konva.RegularPolygon, Konva.Shape);
|
Konva.Util.extend(Konva.RegularPolygon, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.RegularPolygon, 'radius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.RegularPolygon,
|
||||||
|
'radius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set radius
|
* set radius
|
||||||
@ -93,7 +98,12 @@
|
|||||||
* @memberof Konva.RegularPolygon.prototype
|
* @memberof Konva.RegularPolygon.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.RegularPolygon, 'sides', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.RegularPolygon,
|
||||||
|
'sides',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set number of sides
|
* set number of sides
|
||||||
|
@ -72,7 +72,12 @@
|
|||||||
Konva.Util.extend(Konva.Ring, Konva.Shape);
|
Konva.Util.extend(Konva.Ring, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Ring, 'innerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Ring,
|
||||||
|
'innerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set innerRadius
|
* get/set innerRadius
|
||||||
@ -88,7 +93,12 @@
|
|||||||
* // set inner radius
|
* // set inner radius
|
||||||
* ring.innerRadius(20);
|
* ring.innerRadius(20);
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetter(Konva.Ring, 'outerRadius', 0);
|
Konva.Factory.addGetter(
|
||||||
|
Konva.Ring,
|
||||||
|
'outerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Ring, 'outerRadius');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Ring, 'outerRadius');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,7 +314,12 @@
|
|||||||
* sprite.image(imageObj);
|
* sprite.image(imageObj);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Sprite, 'frameIndex', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Sprite,
|
||||||
|
'frameIndex',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set/set animation frame index
|
* set/set animation frame index
|
||||||
@ -331,7 +336,12 @@
|
|||||||
* sprite.frameIndex(3);
|
* sprite.frameIndex(3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Sprite, 'frameRate', 17);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Sprite,
|
||||||
|
'frameRate',
|
||||||
|
17,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set frame rate in frames per second. Increase this number to make the sprite
|
* get/set frame rate in frames per second. Increase this number to make the sprite
|
||||||
|
@ -79,7 +79,12 @@
|
|||||||
Konva.Util.extend(Konva.Star, Konva.Shape);
|
Konva.Util.extend(Konva.Star, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Star, 'numPoints', 5);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Star,
|
||||||
|
'numPoints',
|
||||||
|
5,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set number of points
|
* set number of points
|
||||||
@ -96,7 +101,12 @@
|
|||||||
* @memberof Konva.Star.prototype
|
* @memberof Konva.Star.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Star, 'innerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Star,
|
||||||
|
'innerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set inner radius
|
* set inner radius
|
||||||
@ -113,7 +123,12 @@
|
|||||||
* @memberof Konva.Star.prototype
|
* @memberof Konva.Star.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Star, 'outerRadius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Star,
|
||||||
|
'outerRadius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set outer radius
|
* set outer radius
|
||||||
|
@ -474,6 +474,18 @@
|
|||||||
};
|
};
|
||||||
Konva.Util.extend(Konva.Text, Konva.Shape);
|
Konva.Util.extend(Konva.Text, Konva.Shape);
|
||||||
|
|
||||||
|
Konva.Factory.addSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'width',
|
||||||
|
Konva.Validators.getNumberOrAutoValidator()
|
||||||
|
);
|
||||||
|
|
||||||
|
Konva.Factory.addSetter(
|
||||||
|
Konva.Node,
|
||||||
|
'height',
|
||||||
|
Konva.Validators.getNumberOrAutoValidator()
|
||||||
|
);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Text, 'fontFamily', 'Arial');
|
Konva.Factory.addGetterSetter(Konva.Text, 'fontFamily', 'Arial');
|
||||||
|
|
||||||
@ -492,7 +504,12 @@
|
|||||||
* text.fontFamily('Arial');
|
* text.fontFamily('Arial');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Text, 'fontSize', 12);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Text,
|
||||||
|
'fontSize',
|
||||||
|
12,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set font size in pixels
|
* get/set font size in pixels
|
||||||
@ -543,7 +560,12 @@
|
|||||||
* text.fontVariant('small-caps');
|
* text.fontVariant('small-caps');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Text, 'padding', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Text,
|
||||||
|
'padding',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set padding
|
* set padding
|
||||||
@ -580,7 +602,12 @@
|
|||||||
* text.align('right');
|
* text.align('right');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Text, 'lineHeight', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Text,
|
||||||
|
'lineHeight',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set line height. The default is 1.
|
* get/set line height. The default is 1.
|
||||||
@ -632,7 +659,12 @@
|
|||||||
* text.ellipsis(true);
|
* text.ellipsis(true);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Text, 'letterSpacing', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Text,
|
||||||
|
'letterSpacing',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set letter spacing property. Default value is 0.
|
* set letter spacing property. Default value is 0.
|
||||||
|
@ -558,7 +558,12 @@
|
|||||||
* @memberof Konva.TextPath.prototype
|
* @memberof Konva.TextPath.prototype
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.TextPath, 'fontSize', 12);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.TextPath,
|
||||||
|
'fontSize',
|
||||||
|
12,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set font size
|
* set font size
|
||||||
@ -604,7 +609,12 @@
|
|||||||
* text.align('right');
|
* text.align('right');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.TextPath, 'letterSpacing', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.TextPath,
|
||||||
|
'letterSpacing',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set letter spacing property. Default value is 0.
|
* set letter spacing property. Default value is 0.
|
||||||
|
@ -871,7 +871,12 @@
|
|||||||
* // set
|
* // set
|
||||||
* transformer.anchorSize(20)
|
* transformer.anchorSize(20)
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Transformer, 'anchorSize', 10);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Transformer,
|
||||||
|
'anchorSize',
|
||||||
|
10,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set ability to rotate.
|
* get/set ability to rotate.
|
||||||
@ -919,7 +924,12 @@
|
|||||||
* // set
|
* // set
|
||||||
* transformer.rotateAnchorOffset(100);
|
* transformer.rotateAnchorOffset(100);
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Transformer, 'rotateAnchorOffset', 50);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Transformer,
|
||||||
|
'rotateAnchorOffset',
|
||||||
|
50,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set visibility of border
|
* get/set visibility of border
|
||||||
@ -971,7 +981,12 @@
|
|||||||
* // set
|
* // set
|
||||||
* transformer.anchorStrokeWidth(3);
|
* transformer.anchorStrokeWidth(3);
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Transformer, 'anchorStrokeWidth', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Transformer,
|
||||||
|
'anchorStrokeWidth',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set anchor fill color
|
* get/set anchor fill color
|
||||||
@ -1023,7 +1038,12 @@
|
|||||||
* // set
|
* // set
|
||||||
* transformer.borderStrokeWidth(3);
|
* transformer.borderStrokeWidth(3);
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Transformer, 'borderStrokeWidth', 1);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Transformer,
|
||||||
|
'borderStrokeWidth',
|
||||||
|
1,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set border dash array
|
* get/set border dash array
|
||||||
@ -1071,7 +1091,12 @@
|
|||||||
* // set
|
* // set
|
||||||
* transformer.padding(10);
|
* transformer.padding(10);
|
||||||
*/
|
*/
|
||||||
Konva.Factory.addGetterSetter(Konva.Transformer, 'padding', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Transformer,
|
||||||
|
'padding',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
Konva.Factory.addOverloadedGetterSetter(Konva.Transformer, 'node');
|
Konva.Factory.addOverloadedGetterSetter(Konva.Transformer, 'node');
|
||||||
|
|
||||||
|
@ -73,7 +73,12 @@
|
|||||||
Konva.Util.extend(Konva.Wedge, Konva.Shape);
|
Konva.Util.extend(Konva.Wedge, Konva.Shape);
|
||||||
|
|
||||||
// add getters setters
|
// add getters setters
|
||||||
Konva.Factory.addGetterSetter(Konva.Wedge, 'radius', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Wedge,
|
||||||
|
'radius',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set radius
|
* get/set radius
|
||||||
@ -90,7 +95,12 @@
|
|||||||
* wedge.radius(10);
|
* wedge.radius(10);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.Wedge, 'angle', 0);
|
Konva.Factory.addGetterSetter(
|
||||||
|
Konva.Wedge,
|
||||||
|
'angle',
|
||||||
|
0,
|
||||||
|
Konva.Validators.getNumberValidator()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get/set angle in degrees
|
* get/set angle in degrees
|
||||||
|
@ -925,7 +925,7 @@ suite('Container', function() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '18',
|
fontSize: 18,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text: "The quick brown fox jumped over the lazy dog's back",
|
text: "The quick brown fox jumped over the lazy dog's back",
|
||||||
data: 'M 10,10 300,150 550,150'
|
data: 'M 10,10 300,150 550,150'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
suite('Caching', function() {
|
suite('Caching', function() {
|
||||||
this.timeout(5000);
|
// this.timeout(5000);
|
||||||
// CACHING SHAPE
|
// CACHING SHAPE
|
||||||
|
|
||||||
test('cache simple rectangle', function() {
|
test('cache simple rectangle', function() {
|
||||||
@ -423,8 +423,8 @@ suite('Caching', function() {
|
|||||||
radius: 25,
|
radius: 25,
|
||||||
fill: 'red',
|
fill: 'red',
|
||||||
// rotation on circle should not have any effects
|
// rotation on circle should not have any effects
|
||||||
|
stroke: 'black',
|
||||||
rotation: 45,
|
rotation: 45,
|
||||||
stroke: 2,
|
|
||||||
scaleX: 2,
|
scaleX: 2,
|
||||||
scaleY: 2
|
scaleY: 2
|
||||||
});
|
});
|
||||||
@ -537,7 +537,7 @@ suite('Caching', function() {
|
|||||||
fill: 'red',
|
fill: 'red',
|
||||||
// rotation on circle should not have any effects
|
// rotation on circle should not have any effects
|
||||||
rotation: 45,
|
rotation: 45,
|
||||||
stroke: 2,
|
stroke: 'black',
|
||||||
scaleX: 2,
|
scaleX: 2,
|
||||||
scaleY: 2
|
scaleY: 2
|
||||||
});
|
});
|
||||||
|
@ -3318,8 +3318,8 @@ suite('Node', function() {
|
|||||||
circle.visible(false);
|
circle.visible(false);
|
||||||
assert.equal(circle.visible(), false);
|
assert.equal(circle.visible(), false);
|
||||||
|
|
||||||
circle.transformsEnabled(false);
|
// circle.transformsEnabled(false);
|
||||||
assert.equal(circle.transformsEnabled(), false);
|
// assert.equal(circle.transformsEnabled(), false);
|
||||||
|
|
||||||
circle.position({ x: 6, y: 8 });
|
circle.position({ x: 6, y: 8 });
|
||||||
assert.equal(circle.position().x, 6);
|
assert.equal(circle.position().x, 6);
|
||||||
|
@ -16,7 +16,7 @@ suite('TextPath', function() {
|
|||||||
|
|
||||||
var textpath = new Konva.TextPath({
|
var textpath = new Konva.TextPath({
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '24',
|
fontSize: 24,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text: "The quick brown fox jumped over the lazy dog's back",
|
text: "The quick brown fox jumped over the lazy dog's back",
|
||||||
data: c
|
data: c
|
||||||
@ -64,7 +64,7 @@ suite('TextPath', function() {
|
|||||||
|
|
||||||
var textpath = new Konva.TextPath({
|
var textpath = new Konva.TextPath({
|
||||||
fill: 'black',
|
fill: 'black',
|
||||||
fontSize: '10',
|
fontSize: 10,
|
||||||
text:
|
text:
|
||||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||||
data: c
|
data: c
|
||||||
@ -116,7 +116,7 @@ suite('TextPath', function() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '18',
|
fontSize: 18,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text: "The quick brown fox jumped over the lazy dog's back",
|
text: "The quick brown fox jumped over the lazy dog's back",
|
||||||
data: c
|
data: c
|
||||||
@ -139,7 +139,7 @@ suite('TextPath', function() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '18',
|
fontSize: 18,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text: "The quick brown fox jumped over the lazy dog's back",
|
text: "The quick brown fox jumped over the lazy dog's back",
|
||||||
data: c
|
data: c
|
||||||
@ -167,7 +167,7 @@ suite('TextPath', function() {
|
|||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '8',
|
fontSize: 8,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text:
|
text:
|
||||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||||
@ -194,7 +194,7 @@ suite('TextPath', function() {
|
|||||||
|
|
||||||
var textpath = new Konva.TextPath({
|
var textpath = new Konva.TextPath({
|
||||||
fill: 'black',
|
fill: 'black',
|
||||||
fontSize: '10',
|
fontSize: 10,
|
||||||
text:
|
text:
|
||||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.",
|
||||||
data: c
|
data: c
|
||||||
@ -215,7 +215,7 @@ suite('TextPath', function() {
|
|||||||
var textpath = new Konva.TextPath({
|
var textpath = new Konva.TextPath({
|
||||||
y: 50,
|
y: 50,
|
||||||
fill: 'black',
|
fill: 'black',
|
||||||
fontSize: '24',
|
fontSize: 24,
|
||||||
text: Array(4).join(
|
text: Array(4).join(
|
||||||
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts."
|
"All the world's a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts."
|
||||||
),
|
),
|
||||||
@ -376,7 +376,7 @@ suite('TextPath', function() {
|
|||||||
|
|
||||||
var textpath = new Konva.TextPath({
|
var textpath = new Konva.TextPath({
|
||||||
fill: 'orange',
|
fill: 'orange',
|
||||||
fontSize: '24',
|
fontSize: 24,
|
||||||
fontFamily: 'Arial',
|
fontFamily: 'Arial',
|
||||||
text: "The quick brown fox jumped over the lazy dog's back",
|
text: "The quick brown fox jumped over the lazy dog's back",
|
||||||
data: c,
|
data: c,
|
||||||
|
Loading…
Reference in New Issue
Block a user