fix transformer on parent transform change. close #834

This commit is contained in:
Anton Lavrenov
2020-04-08 17:27:18 -05:00
parent d297cec70b
commit 2423ec261b
6 changed files with 57 additions and 15 deletions

View File

@@ -267,6 +267,8 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
*/
_clearSelfAndDescendantCache(attr?: string) {
this._clearCache(attr);
// trigger clear cache, so transformer can use it
this.fire('clearCache');
// skip clearing if node is cached with canvas
// for performance reasons !!!
@@ -1652,8 +1654,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* // fire click event that bubbles
* node.fire('click', null, true);
*/
fire(eventType, evt, bubble?) {
evt = evt || {};
fire(eventType, evt: any = {}, bubble?) {
evt.target = evt.target || this;
// bubble
if (bubble) {

View File

@@ -70,7 +70,9 @@ var TRANSFORM_CHANGE_STR = [
'offsetXChange',
'offsetYChange',
'transformsEnabledChange',
'strokeWidthChange'
'strokeWidthChange',
// listen to cache changes
'clearCache'
]
.map(e => e + `.${EVENTS_NAME}`)
.join(' ');