Drag slider position on bar, and no jump on drag
Hello I was trying to create a slider that would follow along the x axis and stay within the range of the bar on the canvas. Right now the orangeHash is at the top of the stage, would like it to be on the left beginning part of the hash bar.
My code is:
Any help would be greatly appreciated.


/*stage.mouseMoveOutside = true;*/
var orangeHash = new createjs.Shape(new createjs.Graphics().beginFill("#ff8000").drawRect(0, 0, 20, 60));
orangeHash.setBounds(0, 0, 30, 60);
var orangeHashBounds = orangeHash.getBounds();
console.log(orangeHashBounds);
var orangeHashBoundary = new createjs.Shape();
orangeHashBoundary.graphics.beginStroke("#999")
.setStrokeStyle(1)
.drawRect(117, 376, 1206, 60);
orangeHashBoundary.snapToPixel = true;
orangeHashBoundary.setBounds(117, 376, 1200, 60);
var bounds = orangeHashBoundary.getBounds();
stage.addChild(orangeHashBoundary, orangeHash);
orangeHash.on("mousedown", function(e) {
var localToTrack = e.currentTarget.globalToLocal(e.stageX, e.stageY);
e.currentTarget.regX = localToTrack.x;
e.currentTarget.regY = localToTrack.y;
});
orangeHash.on("pressmove", function(evt) {
evt.currentTarget.x = Math.max(bounds.x + evt.currentTarget.regX,
Math.min(bounds.x + bounds.width - orangeHashBounds.width + evt.currentTarget.regX, evt.stageX));
stage.update();
});
orangeHash.x = bounds.x
stage.update();
