mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 09:48:30 +08:00
undoing optimized drag and drop for now because I added it in due to Google Chrome's latest release which made drag and drop very slow (while other browsers are still fast), and the changes that I made to help work around it were slightly effecting the experience in other browsers. I'll file a ticket with Google Chrome instead
This commit is contained in:
parent
5c7b969974
commit
1c8669eb7a
25
dist/kinetic-core.js
vendored
25
dist/kinetic-core.js
vendored
@ -3,7 +3,7 @@
|
|||||||
* http://www.kineticjs.com/
|
* http://www.kineticjs.com/
|
||||||
* Copyright 2012, Eric Rowell
|
* Copyright 2012, Eric Rowell
|
||||||
* Licensed under the MIT or GPL Version 2 licenses.
|
* Licensed under the MIT or GPL Version 2 licenses.
|
||||||
* Date: Apr 12 2012
|
* Date: Apr 14 2012
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 - 2012 by Eric Rowell
|
* Copyright (C) 2011 - 2012 by Eric Rowell
|
||||||
*
|
*
|
||||||
@ -45,7 +45,7 @@ Kinetic.GlobalObject = {
|
|||||||
animations: [],
|
animations: [],
|
||||||
animIdCounter: 0,
|
animIdCounter: 0,
|
||||||
dragTimeInterval: 0,
|
dragTimeInterval: 0,
|
||||||
maxDragTimeInterval: 15,
|
maxDragTimeInterval: 20,
|
||||||
frame: {
|
frame: {
|
||||||
time: 0,
|
time: 0,
|
||||||
timeDiff: 0,
|
timeDiff: 0,
|
||||||
@ -1772,6 +1772,12 @@ Kinetic.Stage.prototype = {
|
|||||||
var dc = node.attrs.dragConstraint;
|
var dc = node.attrs.dragConstraint;
|
||||||
var db = node.attrs.dragBounds;
|
var db = node.attrs.dragBounds;
|
||||||
|
|
||||||
|
// default
|
||||||
|
var newNodePos = {
|
||||||
|
x: pos.x - go.drag.offset.x,
|
||||||
|
y: pos.y - go.drag.offset.y
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* handle dynamice drag time interval. As the distance between
|
* handle dynamice drag time interval. As the distance between
|
||||||
* the mouse and cursor increases, we need to increase the drag
|
* the mouse and cursor increases, we need to increase the drag
|
||||||
@ -1780,14 +1786,13 @@ Kinetic.Stage.prototype = {
|
|||||||
* is zero, the time interval is zero. When the difference approahces
|
* is zero, the time interval is zero. When the difference approahces
|
||||||
* infinity, the time interval approaches the max drag time interval
|
* infinity, the time interval approaches the max drag time interval
|
||||||
*/
|
*/
|
||||||
var dragDiff = Math.abs(pos.x - node.attrs.x);
|
/*
|
||||||
go.dragTimeInterval = go.maxDragTimeInterval * dragDiff / (dragDiff + 1);
|
var dragDiffX = Math.abs(newNodePos.x - node.attrs.x);
|
||||||
|
var dragDiffY = Math.abs(newNodePos.y - node.attrs.y);
|
||||||
// default
|
var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2));
|
||||||
var newNodePos = {
|
go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1);
|
||||||
x: pos.x - go.drag.offset.x,
|
console.log(dragDiff + ',' + go.dragTimeInterval);
|
||||||
y: pos.y - go.drag.offset.y
|
*/
|
||||||
};
|
|
||||||
|
|
||||||
// bounds overrides
|
// bounds overrides
|
||||||
if(db.left !== undefined && newNodePos.x < db.left) {
|
if(db.left !== undefined && newNodePos.x < db.left) {
|
||||||
|
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
@ -17,7 +17,7 @@ Kinetic.GlobalObject = {
|
|||||||
animations: [],
|
animations: [],
|
||||||
animIdCounter: 0,
|
animIdCounter: 0,
|
||||||
dragTimeInterval: 0,
|
dragTimeInterval: 0,
|
||||||
maxDragTimeInterval: 15,
|
maxDragTimeInterval: 20,
|
||||||
frame: {
|
frame: {
|
||||||
time: 0,
|
time: 0,
|
||||||
timeDiff: 0,
|
timeDiff: 0,
|
||||||
|
21
src/Stage.js
21
src/Stage.js
@ -718,6 +718,12 @@ Kinetic.Stage.prototype = {
|
|||||||
var dc = node.attrs.dragConstraint;
|
var dc = node.attrs.dragConstraint;
|
||||||
var db = node.attrs.dragBounds;
|
var db = node.attrs.dragBounds;
|
||||||
|
|
||||||
|
// default
|
||||||
|
var newNodePos = {
|
||||||
|
x: pos.x - go.drag.offset.x,
|
||||||
|
y: pos.y - go.drag.offset.y
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* handle dynamice drag time interval. As the distance between
|
* handle dynamice drag time interval. As the distance between
|
||||||
* the mouse and cursor increases, we need to increase the drag
|
* the mouse and cursor increases, we need to increase the drag
|
||||||
@ -726,14 +732,13 @@ Kinetic.Stage.prototype = {
|
|||||||
* is zero, the time interval is zero. When the difference approahces
|
* is zero, the time interval is zero. When the difference approahces
|
||||||
* infinity, the time interval approaches the max drag time interval
|
* infinity, the time interval approaches the max drag time interval
|
||||||
*/
|
*/
|
||||||
var dragDiff = Math.abs(pos.x - node.attrs.x);
|
/*
|
||||||
go.dragTimeInterval = go.maxDragTimeInterval * dragDiff / (dragDiff + 1);
|
var dragDiffX = Math.abs(newNodePos.x - node.attrs.x);
|
||||||
|
var dragDiffY = Math.abs(newNodePos.y - node.attrs.y);
|
||||||
// default
|
var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2));
|
||||||
var newNodePos = {
|
go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1);
|
||||||
x: pos.x - go.drag.offset.x,
|
console.log(dragDiff + ',' + go.dragTimeInterval);
|
||||||
y: pos.y - go.drag.offset.y
|
*/
|
||||||
};
|
|
||||||
|
|
||||||
// bounds overrides
|
// bounds overrides
|
||||||
if(db.left !== undefined && newNodePos.x < db.left) {
|
if(db.left !== undefined && newNodePos.x < db.left) {
|
||||||
|
@ -10,7 +10,7 @@ function log(message) {
|
|||||||
* Test constructor
|
* Test constructor
|
||||||
*/
|
*/
|
||||||
function Test() {
|
function Test() {
|
||||||
this.testOnly = '';
|
this.testOnly = 'DRAG AND DROP - draggable true';
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user