discovered that the slow drag and drop behavior with Google Chrome is only effecting my Windows 7 test machine, not Mac. I've removed the drag and drop optimizing code for now

This commit is contained in:
Eric Rowell 2012-04-14 12:15:01 -07:00
parent 3a520376e5
commit 5e46018012
4 changed files with 12 additions and 8 deletions

View File

@ -46,7 +46,7 @@ Kinetic.GlobalObject = {
animIdCounter: 0, animIdCounter: 0,
dragTimeInterval: 0, dragTimeInterval: 0,
maxDragTimeInterval: 20, maxDragTimeInterval: 20,
isChrome: navigator.userAgent.toLowerCase().indexOf('chrome') > -1, //isChrome: navigator.userAgent.toLowerCase().indexOf('chrome') > -1,
frame: { frame: {
time: 0, time: 0,
timeDiff: 0, timeDiff: 0,
@ -1838,7 +1838,7 @@ Kinetic.Stage.prototype = {
* For google chrome instances, dynamically set the dragTimeInterval * For google chrome instances, dynamically set the dragTimeInterval
* to improve drag and drop performance while not effecting other browsers * to improve drag and drop performance while not effecting other browsers
*/ */
if(go.isChrome) { //if(go.isChrome) {
/* /*
* 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
@ -1847,11 +1847,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 dragDiffX = Math.abs(newNodePos.x - node.attrs.x); var dragDiffX = Math.abs(newNodePos.x - node.attrs.x);
var dragDiffY = Math.abs(newNodePos.y - node.attrs.y); var dragDiffY = Math.abs(newNodePos.y - node.attrs.y);
var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2)); var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2));
go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1); go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1);
} */
//}
// bounds overrides // bounds overrides
if(db.left !== undefined && newNodePos.x < db.left) { if(db.left !== undefined && newNodePos.x < db.left) {

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ Kinetic.GlobalObject = {
animIdCounter: 0, animIdCounter: 0,
dragTimeInterval: 0, dragTimeInterval: 0,
maxDragTimeInterval: 20, maxDragTimeInterval: 20,
isChrome: navigator.userAgent.toLowerCase().indexOf('chrome') > -1, //isChrome: navigator.userAgent.toLowerCase().indexOf('chrome') > -1,
frame: { frame: {
time: 0, time: 0,
timeDiff: 0, timeDiff: 0,

View File

@ -729,7 +729,7 @@ Kinetic.Stage.prototype = {
* For google chrome instances, dynamically set the dragTimeInterval * For google chrome instances, dynamically set the dragTimeInterval
* to improve drag and drop performance while not effecting other browsers * to improve drag and drop performance while not effecting other browsers
*/ */
if(go.isChrome) { //if(go.isChrome) {
/* /*
* 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
@ -738,11 +738,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 dragDiffX = Math.abs(newNodePos.x - node.attrs.x); var dragDiffX = Math.abs(newNodePos.x - node.attrs.x);
var dragDiffY = Math.abs(newNodePos.y - node.attrs.y); var dragDiffY = Math.abs(newNodePos.y - node.attrs.y);
var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2)); var dragDiff = Math.sqrt(Math.pow(dragDiffX, 2) + Math.pow(dragDiffY, 2));
go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1); go.dragTimeInterval = go.maxDragTimeInterval * (dragDiff - 1) / (dragDiff + 1);
} */
//}
// bounds overrides // bounds overrides
if(db.left !== undefined && newNodePos.x < db.left) { if(db.left !== undefined && newNodePos.x < db.left) {