# HG changeset patch # User hamidouk # Date 1327075634 -3600 # Node ID dfd601bd2ea8c970ba0071d99275f1639cfcb80a # Parent 76953dd536de5f1561e42ed4bbc206ae244814d0 WIP - redoing the resize slice function. do not use. diff -r 76953dd536de -r dfd601bd2ea8 src/js/widgets/sliceWidget.js --- a/src/js/widgets/sliceWidget.js Fri Jan 20 17:06:49 2012 +0100 +++ b/src/js/widgets/sliceWidget.js Fri Jan 20 17:07:14 2012 +0100 @@ -69,22 +69,34 @@ */ var currentX = this.leftHandle.position()["left"]; - var rightHandleX = this.rightHandle.position()["left"]; + var rightHandleX = Math.floor(this.rightHandle.position()["left"]); + //ui.position.left = Math.floor(ui.position.left); if (currentX >= rightHandleX - 7 && ui.position.left >= this._leftHandleOldLeft) { /* prevent the handle from moving past the right handle */ ui.position.left = this._leftHandleOldLeft; } - var increment = this.zoneLeft - (currentX + 7); + if (ui.position.left > this._leftHandleOldLeft) { + console.log(ui.position.left, this._leftHandleOldLeft); + var increment = 1; + } else if (ui.position.left < this._leftHandleOldLeft) + var increment = -1; + else + var increment = 0; - this.zoneWidth += increment; - this.zoneLeft = currentX + 7; + // the width of the zone is supposed to diminish by increment + // while at the same time the position of the zone should + // change by the opposite increment. + this.zoneWidth = this.zoneWidth - increment; + this.zoneLeft = Math.floor(this._leftHandleOldLeft + increment + 7); + this.sliceZone.css("width", this.zoneWidth); this.sliceZone.css("left", this.zoneLeft + "px"); + this._leftHandleOldLeft = Math.floor(this._leftHandleOldLeft + increment); + ui.position.left = this._leftHandleOldLeft; this.broadcastChanges(); - - this._leftHandleOldLeft = ui.position.left; + }; /** handle a dragging of the right handle */