Comparing version 2.1.4 to 2.1.5
@@ -8,2 +8,9 @@ # Change Log | ||
## [2.1.5][2018-06-15] | ||
## Fixed | ||
* Typescript fixes | ||
* add shape as second argument for `sceneFunc` and `hitFunc` | ||
## [2.1.4][2018-06-15] | ||
@@ -10,0 +17,0 @@ |
@@ -837,2 +837,3 @@ declare namespace Konva { | ||
pointerWidth?: number; | ||
pointerAtBeginning?: boolean; | ||
} | ||
@@ -1063,2 +1064,3 @@ | ||
node?: Rect; | ||
boundBoxFunc?: (oldBox: SizeConfig, newBox: SizeConfig) => SizeConfig; | ||
} | ||
@@ -1065,0 +1067,0 @@ |
{ | ||
"name": "konva", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"author": "Anton Lavrenov", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -26,3 +26,3 @@ <p align="center"> | ||
```html | ||
<script src="https://cdn.rawgit.com/konvajs/konva/2.1.4/konva.min.js"></script> | ||
<script src="https://cdn.rawgit.com/konvajs/konva/2.1.5/konva.min.js"></script> | ||
<div id="container"></div> | ||
@@ -29,0 +29,0 @@ <script> |
@@ -42,3 +42,3 @@ (function(Konva) { | ||
* // a Konva.Canvas renderer is passed into the sceneFunc function | ||
* sceneFunc: function(context) { | ||
* sceneFunc: function(context, shape) { | ||
* context.beginPath(); | ||
@@ -49,3 +49,4 @@ * context.moveTo(200, 50); | ||
* context.closePath(); | ||
* context.fillStrokeShape(this); | ||
* // Konva specific method | ||
* context.fillStrokeShape(shape); | ||
* } | ||
@@ -345,3 +346,3 @@ *}); | ||
drawFunc.call(this, bufferContext); | ||
drawFunc.call(this, bufferContext, this); | ||
bufferContext.restore(); | ||
@@ -397,3 +398,3 @@ | ||
drawFunc.call(this, context); | ||
drawFunc.call(this, context, this); | ||
context.restore(); | ||
@@ -404,3 +405,3 @@ // if shape has stroke we need to redraw shape | ||
if (this.hasFill() && this.getShadowForStrokeEnabled()) { | ||
drawFunc.call(this, context); | ||
drawFunc.call(this, context, this); | ||
} | ||
@@ -414,3 +415,3 @@ } else if (hasShadow && !canvas.hitCanvas) { | ||
context._applyShadow(this); | ||
drawFunc.call(this, context); | ||
drawFunc.call(this, context, this); | ||
context.restore(); | ||
@@ -422,3 +423,3 @@ } else { | ||
} | ||
drawFunc.call(this, context); | ||
drawFunc.call(this, context, this); | ||
} | ||
@@ -463,3 +464,3 @@ } | ||
} | ||
drawFunc.call(this, context); | ||
drawFunc.call(this, context, this); | ||
context.restore(); | ||
@@ -466,0 +467,0 @@ return this; |
@@ -108,2 +108,3 @@ (function(Konva) { | ||
* @param {Array} [config.enabledHandlers] Array of names of enabled handles | ||
* @param {Function} [config.boundBoxFunc] Bounding box function | ||
* @example | ||
@@ -163,2 +164,10 @@ * var transformer = new Konva.Transformer({ | ||
/** | ||
* alias to `setNode` | ||
* @method | ||
* @memberof Konva.Transformer.prototype | ||
* @returns {Konva.Transformer} | ||
* @example | ||
* transformer.attachTo(shape); | ||
*/ | ||
attachTo: function(node) { | ||
@@ -169,3 +178,3 @@ this.setNode(node); | ||
/** | ||
* attach transformer to a Konva.Node. Transformer will adapt it its size and listed events | ||
* attach transformer to a Konva.Node. Transformer will adapt to its size and listen its events | ||
* @method | ||
@@ -175,3 +184,3 @@ * @memberof Konva.Transformer.prototype | ||
* @example | ||
* transformer.attachTo(shape); | ||
* transformer.setNode(shape); | ||
*/ | ||
@@ -767,6 +776,6 @@ setNode: function(node) { | ||
* // get list of handlers | ||
* var enabledHandlers = shape.enabledHandlers(); | ||
* var enabledHandlers = transformer.enabledHandlers(); | ||
* | ||
* // set handlers | ||
* shape.enabledHandlers(['top-left', 'top-center', 'top-right', 'middle-right', 'middle-left', 'bottom-left', 'bottom-center', 'bottom-right']); | ||
* transformer.enabledHandlers(['top-left', 'top-center', 'top-right', 'middle-right', 'middle-left', 'bottom-left', 'bottom-center', 'bottom-right']); | ||
*/ | ||
@@ -789,6 +798,6 @@ Konva.Factory.addGetterSetter( | ||
* // get | ||
* var resizeEnabled = shape.resizeEnabled(); | ||
* var resizeEnabled = transformer.resizeEnabled(); | ||
* | ||
* // set | ||
* shape.resizeEnabled(false); | ||
* transformer.resizeEnabled(false); | ||
*/ | ||
@@ -802,10 +811,10 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'resizeEnabled', true); | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Array} array | ||
* @returns {Array} | ||
* @param {Boolean} enabled | ||
* @returns {Boolean} | ||
* @example | ||
* // get | ||
* var rotateEnabled = shape.rotateEnabled(); | ||
* var rotateEnabled = transformer.rotateEnabled(); | ||
* | ||
* // set | ||
* shape.rotateEnabled(false); | ||
* transformer.rotateEnabled(false); | ||
*/ | ||
@@ -823,6 +832,6 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'rotateEnabled', true); | ||
* // get | ||
* var rotationSnaps = shape.rotationSnaps(); | ||
* var rotationSnaps = transformer.rotationSnaps(); | ||
* | ||
* // set | ||
* shape.rotationSnaps([0, 90, 180, 270]); | ||
* transformer.rotationSnaps([0, 90, 180, 270]); | ||
*/ | ||
@@ -836,10 +845,10 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'rotationSnaps', []); | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Array} array | ||
* @returns {Array} | ||
* @param {Number} offset | ||
* @returns {Number} | ||
* @example | ||
* // get | ||
* var rotateHandlerOffset = shape.rotateHandlerOffset(); | ||
* var rotateHandlerOffset = transformer.rotateHandlerOffset(); | ||
* | ||
* // set | ||
* shape.rotateHandlerOffset(100); | ||
* transformer.rotateHandlerOffset(100); | ||
*/ | ||
@@ -853,10 +862,10 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'rotateHandlerOffset', 50); | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Array} array | ||
* @returns {Array} | ||
* @param {Boolean} enabled | ||
* @returns {Boolean} | ||
* @example | ||
* // get | ||
* var lineEnabled = shape.lineEnabled(); | ||
* var lineEnabled = transformer.lineEnabled(); | ||
* | ||
* // set | ||
* shape.lineEnabled(false); | ||
* transformer.lineEnabled(false); | ||
*/ | ||
@@ -870,10 +879,10 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'lineEnabled', true); | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Array} array | ||
* @returns {Array} | ||
* @param {Boolean} keepRatio | ||
* @returns {Boolean} | ||
* @example | ||
* // get | ||
* var keepRatio = shape.keepRatio(); | ||
* var keepRatio = transformer.keepRatio(); | ||
* | ||
* // set | ||
* shape.keepRatio(false); | ||
* transformer.keepRatio(false); | ||
*/ | ||
@@ -887,10 +896,10 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'keepRatio', true); | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Array} array | ||
* @returns {Array} | ||
* @param {Number} padding | ||
* @returns {Number} | ||
* @example | ||
* // get | ||
* var padding = shape.padding(); | ||
* var padding = transformer.padding(); | ||
* | ||
* // set | ||
* shape.padding(10); | ||
* transformer.padding(10); | ||
*/ | ||
@@ -901,2 +910,21 @@ Konva.Factory.addGetterSetter(Konva.Transformer, 'padding', 0); | ||
/** | ||
* get/set bounding box function | ||
* @name boundBoxFunc | ||
* @method | ||
* @memberof Konva.Transformer.prototype | ||
* @param {Function} func | ||
* @returns {Function} | ||
* @example | ||
* // get | ||
* var boundBoxFunc = transformer.boundBoxFunc(); | ||
* | ||
* // set | ||
* transformer.boundBoxFunc(function(oldBox, newBox) { | ||
* if (newBox.width > 200) { | ||
* return oldBox; | ||
* } | ||
* return newBox; | ||
* }); | ||
*/ | ||
Konva.Factory.addGetterSetter(Konva.Transformer, 'boundBoxFunc'); | ||
@@ -903,0 +931,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1278467
36528