fixed drag and drop issue and reverted default easing back to linear

This commit is contained in:
Eric Rowell 2012-04-01 10:06:00 -07:00
parent 3a8afc747c
commit 71b0449071
6 changed files with 13 additions and 23 deletions

13
dist/kinetic-core.js vendored
View File

@ -137,7 +137,7 @@ Kinetic.GlobalObject = {
return 2.5 + b * transition.time; return 2.5 + b * transition.time;
}); });
break; break;
// none is default // linear is default
default: default:
this._transitionPow(transition, key, prop, function() { this._transitionPow(transition, key, prop, function() {
return 1; return 1;
@ -628,7 +628,7 @@ Kinetic.Node.prototype = {
*/ */
draggable: function(isDraggable) { draggable: function(isDraggable) {
if(this.draggable !== isDraggable) { if(this.draggable !== isDraggable) {
if(isDraggable && this.isDragging()) { if(isDraggable) {
this._initDrag(); this._initDrag();
} }
else { else {
@ -721,8 +721,8 @@ Kinetic.Node.prototype = {
* radius, scale.x, scale.y, centerOffset.x, centerOffset.y, etc. * radius, scale.x, scale.y, centerOffset.x, centerOffset.y, etc.
* @param {Object} config * @param {Object} config
* @config {Number} [duration] duration that the transition runs in seconds * @config {Number} [duration] duration that the transition runs in seconds
* @config {String} [easing] easing function. can be none, ease-in, ease-out, or ease-in-out. * @config {String} [easing] easing function. can be linear, ease-in, ease-out, or ease-in-out.
* none is the default * linear is the default
* @config {Function} [callback] callback function to be executed when * @config {Function} [callback] callback function to be executed when
* transition completes * transition completes
*/ */
@ -848,6 +848,7 @@ Kinetic.Node.prototype = {
* initialize drag and drop * initialize drag and drop
*/ */
_initDrag: function() { _initDrag: function() {
this._dragCleanup();
var go = Kinetic.GlobalObject; var go = Kinetic.GlobalObject;
var that = this; var that = this;
this.on('mousedown.initdrag touchstart.initdrag', function(evt) { this.on('mousedown.initdrag touchstart.initdrag', function(evt) {
@ -1926,9 +1927,7 @@ Kinetic.Shape = function(config) {
} }
} }
if(config.detectionType === undefined) { this.detectionType = 'path';
config.detectionType = 'path';
}
// required // required
this.drawFunc = config.drawFunc; this.drawFunc = config.drawFunc;

File diff suppressed because one or more lines are too long

View File

@ -109,7 +109,7 @@ Kinetic.GlobalObject = {
return 2.5 + b * transition.time; return 2.5 + b * transition.time;
}); });
break; break;
// none is default // linear is default
default: default:
this._transitionPow(transition, key, prop, function() { this._transitionPow(transition, key, prop, function() {
return 1; return 1;

View File

@ -381,7 +381,7 @@ Kinetic.Node.prototype = {
*/ */
draggable: function(isDraggable) { draggable: function(isDraggable) {
if(this.draggable !== isDraggable) { if(this.draggable !== isDraggable) {
if(isDraggable && this.isDragging()) { if(isDraggable) {
this._initDrag(); this._initDrag();
} }
else { else {
@ -474,8 +474,8 @@ Kinetic.Node.prototype = {
* radius, scale.x, scale.y, centerOffset.x, centerOffset.y, etc. * radius, scale.x, scale.y, centerOffset.x, centerOffset.y, etc.
* @param {Object} config * @param {Object} config
* @config {Number} [duration] duration that the transition runs in seconds * @config {Number} [duration] duration that the transition runs in seconds
* @config {String} [easing] easing function. can be none, ease-in, ease-out, or ease-in-out. * @config {String} [easing] easing function. can be linear, ease-in, ease-out, or ease-in-out.
* none is the default * linear is the default
* @config {Function} [callback] callback function to be executed when * @config {Function} [callback] callback function to be executed when
* transition completes * transition completes
*/ */
@ -601,6 +601,7 @@ Kinetic.Node.prototype = {
* initialize drag and drop * initialize drag and drop
*/ */
_initDrag: function() { _initDrag: function() {
this._dragCleanup();
var go = Kinetic.GlobalObject; var go = Kinetic.GlobalObject;
var that = this; var that = this;
this.on('mousedown.initdrag touchstart.initdrag', function(evt) { this.on('mousedown.initdrag touchstart.initdrag', function(evt) {

View File

@ -28,9 +28,7 @@ Kinetic.Shape = function(config) {
} }
} }
if(config.detectionType === undefined) { this.detectionType = 'path';
config.detectionType = 'path';
}
// required // required
this.drawFunc = config.drawFunc; this.drawFunc = config.drawFunc;

View File

@ -1052,14 +1052,6 @@ Test.prototype.tests = {
circle.draggable(true); circle.draggable(true);
circle.draggable(true); circle.draggable(true);
circle.draggable(true);
circle.draggable(false);
circle.draggable(true);
circle.draggable(true);
circle.draggable(true);
// circle should not be draggable
circle.draggable(false); circle.draggable(false);
layer.add(circle); layer.add(circle);