// make sure lastPoint is a legal point to drag to var p = this.lastPoint - this.screenToClientOffset; var a = p - this.dragOffset; a = this.legaliseSplitPoint(a); p = a + this.dragOffset; this.lastPoint = p + this.screenToClientOffset;