mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
Correct cache reset for Konva.Transformer
This commit is contained in:
parent
d685807605
commit
74d7a65b16
@ -5,11 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [new version][unreleased]
|
## [new version][unreleased]
|
||||||
|
|
||||||
|
## [2.1.4][2018-06-15]
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
* Fixed `Konva.Text` justify drawing for a text with decoration
|
* Fixed `Konva.Text` justify drawing for a text with decoration
|
||||||
* Added methods `data()`,`setData()` and `getData()` methods to `Konva.TextPath`
|
* Added methods `data()`,`setData()` and `getData()` methods to `Konva.TextPath`
|
||||||
|
* Correct cache reset for `Konva.Transformer`
|
||||||
|
|
||||||
## [2.1.3][2018-05-17]
|
## [2.1.3][2018-05-17]
|
||||||
|
|
||||||
|
4
konva.js
4
konva.js
@ -2,7 +2,7 @@
|
|||||||
* Konva JavaScript Framework v2.1.3
|
* Konva JavaScript Framework v2.1.3
|
||||||
* http://konvajs.github.io/
|
* http://konvajs.github.io/
|
||||||
* Licensed under the MIT
|
* Licensed under the MIT
|
||||||
* Date: Tue Jun 05 2018
|
* Date: Fri Jun 15 2018
|
||||||
*
|
*
|
||||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||||
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
||||||
@ -18879,7 +18879,7 @@
|
|||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
this._node = node;
|
this._node = node;
|
||||||
this._clearCache(NODE_RECT);
|
this._resetTransformCache();
|
||||||
|
|
||||||
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
|
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
|
||||||
node.on(
|
node.on(
|
||||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -176,7 +176,7 @@
|
|||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
this._node = node;
|
this._node = node;
|
||||||
this._clearCache(NODE_RECT);
|
this._resetTransformCache();
|
||||||
|
|
||||||
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
|
node.on(TRANSFORM_CHANGE_STR, this._resetTransformCache.bind(this));
|
||||||
node.on(
|
node.on(
|
||||||
|
@ -1136,4 +1136,15 @@ suite('Stage', function() {
|
|||||||
};
|
};
|
||||||
image.src = url;
|
image.src = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// test.only('Warn when styles or stage are applied', function() {
|
||||||
|
// var stage = addStage();
|
||||||
|
// // var layer = new Konva.Layer();
|
||||||
|
// // stage.add(layer);
|
||||||
|
// var container = stage.content;
|
||||||
|
// console.log(
|
||||||
|
// getComputedStyle(container).width,
|
||||||
|
// getComputedStyle(container).height
|
||||||
|
// );
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
@ -1101,4 +1101,36 @@ suite('Transformer', function() {
|
|||||||
// assert.equal(rect.height() * rect.scaleY(), 100);
|
// assert.equal(rect.height() * rect.scaleY(), 100);
|
||||||
// assert.equal(rect.rotation(), rect.rotation());
|
// assert.equal(rect.rotation(), rect.rotation());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test cache reset on attach', function() {
|
||||||
|
var stage = addStage();
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
var rect = new Konva.Rect({
|
||||||
|
x: 20,
|
||||||
|
y: 20,
|
||||||
|
draggable: true,
|
||||||
|
width: 150,
|
||||||
|
height: 100,
|
||||||
|
fill: 'yellow'
|
||||||
|
});
|
||||||
|
layer.add(rect);
|
||||||
|
|
||||||
|
var tr = new Konva.Transformer();
|
||||||
|
layer.add(tr);
|
||||||
|
|
||||||
|
// make draw to set all caches
|
||||||
|
layer.draw();
|
||||||
|
// then attach
|
||||||
|
tr.attachTo(rect);
|
||||||
|
|
||||||
|
layer.draw();
|
||||||
|
|
||||||
|
var shape = layer.getIntersection({
|
||||||
|
x: 20,
|
||||||
|
y: 20
|
||||||
|
});
|
||||||
|
assert.equal(shape.name(), 'top-left');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user