mirror of
https://github.com/konvajs/konva.git
synced 2025-12-04 10:58:22 +08:00
transition attr updates now fire the attr change event. Fixed problem with root level attrs not being fired when child level attr changed
This commit is contained in:
38
dist/kinetic-core.js
vendored
38
dist/kinetic-core.js
vendored
@@ -3,7 +3,7 @@
|
||||
* http://www.kineticjs.com/
|
||||
* Copyright 2012, Eric Rowell
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Jun 30 2012
|
||||
* Date: Jul 01 2012
|
||||
*
|
||||
* Copyright (C) 2011 - 2012 by Eric Rowell
|
||||
*
|
||||
@@ -573,7 +573,6 @@ Kinetic.Node.prototype = {
|
||||
setAttrs: function(config) {
|
||||
var go = Kinetic.GlobalObject;
|
||||
var that = this;
|
||||
|
||||
// set properties from config
|
||||
if(config !== undefined) {
|
||||
function setAttrs(obj, c, level) {
|
||||
@@ -644,14 +643,13 @@ Kinetic.Node.prototype = {
|
||||
that._setAttr(obj, key, val);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* only fire change event for root
|
||||
* level attrs
|
||||
*/
|
||||
if(level === 0) {
|
||||
that._fireChangeEvent(key);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* only fire change event for root
|
||||
* level attrs
|
||||
*/
|
||||
if(level === 0) {
|
||||
that._fireChangeEvent(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4921,20 +4919,22 @@ Kinetic.Transition = function(node, config) {
|
||||
var that = this;
|
||||
|
||||
// add tween for each property
|
||||
function addTween(c, attrs) {
|
||||
function addTween(c, attrs, obj, rootObj) {
|
||||
for(var key in c) {
|
||||
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
||||
// if val is an object then traverse
|
||||
if(Kinetic.GlobalObject._isObject(c[key])) {
|
||||
addTween(c[key], attrs[key]);
|
||||
obj[key] = {};
|
||||
addTween(c[key], attrs[key], obj[key], rootObj);
|
||||
}
|
||||
else {
|
||||
that._add(that._getTween(attrs, key, c[key]));
|
||||
that._add(that._getTween(attrs, key, c[key], obj, rootObj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addTween(config, node.attrs);
|
||||
var obj = {};
|
||||
addTween(config, node.attrs, obj, obj);
|
||||
|
||||
var finishedTweens = 0;
|
||||
for(var n = 0; n < this.tweens.length; n++) {
|
||||
@@ -4983,7 +4983,7 @@ Kinetic.Transition.prototype = {
|
||||
_add: function(tween) {
|
||||
this.tweens.push(tween);
|
||||
},
|
||||
_getTween: function(key, prop, val) {
|
||||
_getTween: function(attrs, prop, val, obj, rootObj) {
|
||||
var config = this.config;
|
||||
var node = this.node;
|
||||
var easing = config.easing;
|
||||
@@ -4992,8 +4992,9 @@ Kinetic.Transition.prototype = {
|
||||
}
|
||||
|
||||
var tween = new Kinetic.Tween(node, function(i) {
|
||||
key[prop] = i;
|
||||
}, Kinetic.Tweens[easing], key[prop], val, config.duration);
|
||||
obj[prop] = i;
|
||||
node.setAttrs(rootObj);
|
||||
}, Kinetic.Tweens[easing], attrs[prop], val, config.duration);
|
||||
|
||||
return tween;
|
||||
}
|
||||
@@ -5068,10 +5069,7 @@ Kinetic.Tween.prototype = {
|
||||
},
|
||||
setPosition: function(p) {
|
||||
this.prevPos = this._pos;
|
||||
//var a = this.suffixe != '' ? this.suffixe : '';
|
||||
this.propFunc(p);
|
||||
//+ a;
|
||||
//this.obj(Math.round(p));
|
||||
this._pos = p;
|
||||
this.broadcastMessage('onChanged', {
|
||||
target: this,
|
||||
|
||||
6
dist/kinetic-core.min.js
vendored
6
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user