Comparing version 2.1.2 to 2.1.3
@@ -8,2 +8,9 @@ # Change Log | ||
## [2.1.3][2018-05-17] | ||
## Fixed | ||
* `Konva.Transformer` automatically track shape changes | ||
* `Konva.Transformer` works with shapes with offset too | ||
## [2.1.2][2018-05-16] | ||
@@ -10,0 +17,0 @@ |
{ | ||
"name": "konva", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"author": "Anton Lavrenov", | ||
@@ -60,3 +60,4 @@ "files": [ | ||
}, | ||
"license": "MIT" | ||
"license": "MIT", | ||
"dependencies": {} | ||
} |
@@ -26,3 +26,3 @@ <p align="center"> | ||
```html | ||
<script src="https://cdn.rawgit.com/konvajs/konva/2.1.2/konva.min.js"></script> | ||
<script src="https://cdn.rawgit.com/konvajs/konva/2.1.3/konva.min.js"></script> | ||
<div id="container"></div> | ||
@@ -29,0 +29,0 @@ <script> |
(function(Konva) { | ||
'use strict'; | ||
/** | ||
* BaseLayer constructor. | ||
* @constructor | ||
* @memberof Konva | ||
* @augments Konva.Container | ||
* @param {Object} config | ||
* @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want | ||
* to clear the canvas before each layer draw. The default value is true. | ||
* @@nodeParams | ||
* @@containerParams | ||
*/ | ||
* BaseLayer constructor. | ||
* @constructor | ||
* @memberof Konva | ||
* @augments Konva.Container | ||
* @param {Object} config | ||
* @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want | ||
* to clear the canvas before each layer draw. The default value is true. | ||
* @@nodeParams | ||
* @@containerParams | ||
*/ | ||
Konva.BaseLayer = function(config) { | ||
@@ -15,0 +15,0 @@ this.___init(config); |
(function() { | ||
'use strict'; | ||
/** | ||
* Grayscale Filter | ||
* @function | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Grayscale]); | ||
*/ | ||
* Grayscale Filter | ||
* @function | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Grayscale]); | ||
*/ | ||
Konva.Filters.Grayscale = function(imageData) { | ||
var data = imageData.data, len = data.length, i, brightness; | ||
var data = imageData.data, | ||
len = data.length, | ||
i, | ||
brightness; | ||
@@ -15,0 +18,0 @@ for (i = 0; i < len; i += 4) { |
(function() { | ||
'use strict'; | ||
/** | ||
* Invert Filter | ||
* @function | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Invert]); | ||
*/ | ||
* Invert Filter | ||
* @function | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Invert]); | ||
*/ | ||
Konva.Filters.Invert = function(imageData) { | ||
var data = imageData.data, len = data.length, i; | ||
var data = imageData.data, | ||
len = data.length, | ||
i; | ||
@@ -15,0 +17,0 @@ for (i = 0; i < len; i += 4) { |
(function() { | ||
'use strict'; | ||
/** | ||
* Noise Filter. Randomly adds or substracts to the color channels | ||
* @function | ||
* @name Noise | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Noise]); | ||
* node.noise(0.8); | ||
*/ | ||
* Noise Filter. Randomly adds or substracts to the color channels | ||
* @function | ||
* @name Noise | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Noise]); | ||
* node.noise(0.8); | ||
*/ | ||
Konva.Filters.Noise = function(imageData) { | ||
@@ -37,9 +37,9 @@ var amount = this.noise() * 255, | ||
/** | ||
* get/set noise amount. Must be a value between 0 and 1. Use with {@link Konva.Filters.Noise} filter. | ||
* @name noise | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Number} noise | ||
* @returns {Number} | ||
*/ | ||
* get/set noise amount. Must be a value between 0 and 1. Use with {@link Konva.Filters.Noise} filter. | ||
* @name noise | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Number} noise | ||
* @returns {Number} | ||
*/ | ||
})(); |
@@ -5,14 +5,14 @@ /*eslint-disable max-depth */ | ||
/** | ||
* Pixelate Filter. Averages groups of pixels and redraws | ||
* them as larger pixels | ||
* @function | ||
* @name Pixelate | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Pixelate]); | ||
* node.pixelSize(10); | ||
*/ | ||
* Pixelate Filter. Averages groups of pixels and redraws | ||
* them as larger pixels | ||
* @function | ||
* @name Pixelate | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Pixelate]); | ||
* node.pixelSize(10); | ||
*/ | ||
@@ -114,9 +114,9 @@ Konva.Filters.Pixelate = function(imageData) { | ||
/** | ||
* get/set pixel size. Use with {@link Konva.Filters.Pixelate} filter. | ||
* @name pixelSize | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Integer} pixelSize | ||
* @returns {Integer} | ||
*/ | ||
* get/set pixel size. Use with {@link Konva.Filters.Pixelate} filter. | ||
* @name pixelSize | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Integer} pixelSize | ||
* @returns {Integer} | ||
*/ | ||
})(); |
(function() { | ||
'use strict'; | ||
/** | ||
* Threshold Filter. Pushes any value above the mid point to | ||
* the max and any value below the mid point to the min. | ||
* This affects the alpha channel. | ||
* @function | ||
* @name Threshold | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Threshold]); | ||
* node.threshold(0.1); | ||
*/ | ||
* Threshold Filter. Pushes any value above the mid point to | ||
* the max and any value below the mid point to the min. | ||
* This affects the alpha channel. | ||
* @function | ||
* @name Threshold | ||
* @memberof Konva.Filters | ||
* @param {Object} imageData | ||
* @author ippo615 | ||
* @example | ||
* node.cache(); | ||
* node.filters([Konva.Filters.Threshold]); | ||
* node.threshold(0.1); | ||
*/ | ||
@@ -37,9 +37,9 @@ Konva.Filters.Threshold = function(imageData) { | ||
/** | ||
* get/set threshold. Must be a value between 0 and 1. Use with {@link Konva.Filters.Threshold} or {@link Konva.Filters.Mask} filter. | ||
* @name threshold | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Number} threshold | ||
* @returns {Number} | ||
*/ | ||
* get/set threshold. Must be a value between 0 and 1. Use with {@link Konva.Filters.Threshold} or {@link Konva.Filters.Mask} filter. | ||
* @name threshold | ||
* @method | ||
* @memberof Konva.Node.prototype | ||
* @param {Number} threshold | ||
* @returns {Number} | ||
*/ | ||
})(); |
@@ -26,2 +26,14 @@ (function(Konva) { | ||
var REDRAW_CHANGE_STR = [ | ||
'widthChange.resizer', | ||
'heightChange.resizer', | ||
'scaleXChange.resizer', | ||
'scaleYChange.resizer', | ||
'skewXChange.resizer', | ||
'skewYChange.resizer', | ||
'rotationChange.resizer', | ||
'offsetXChange.resizer', | ||
'offsetYChange.resizer' | ||
].join(' '); | ||
var ANGLES = { | ||
@@ -171,2 +183,10 @@ 'top-left': -45, | ||
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this)); | ||
node.on( | ||
REDRAW_CHANGE_STR, | ||
function() { | ||
if (!this._transforming) { | ||
this.update(); | ||
} | ||
}.bind(this) | ||
); | ||
@@ -225,4 +245,4 @@ // TODO: why do we need this? | ||
var dx = rect.x * node.scaleX() - node.offsetX(); | ||
var dy = rect.y * node.scaleY() - node.offsetY(); | ||
var dx = rect.x * node.scaleX() - node.offsetX() * node.scaleX(); | ||
var dy = rect.y * node.scaleY() - node.offsetY() * node.scaleY(); | ||
@@ -597,4 +617,4 @@ return { | ||
var rotation = Konva.getAngle(node.getRotation()); | ||
var dx = pure.x * scaleX - padding; | ||
var dy = pure.y * scaleY - padding; | ||
var dx = pure.x * scaleX - padding - node.offsetX() * scaleX; | ||
var dy = pure.y * scaleY - padding - node.offsetY() * scaleY; | ||
@@ -601,0 +621,0 @@ this.getNode().setAttrs({ |
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
1278816
36315