Skip to content

Commit

Permalink
Slider高亮区域修改
Browse files Browse the repository at this point in the history
  • Loading branch information
domchen committed Jun 3, 2014
1 parent 8b97948 commit 43e0944
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/extension/gui/components/HSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ module egret {
if (!this.thumb || !this.track)
return;

var thumbWidth:number = this.thumb.layoutBoundsWidth;
var thumbRange:number = this.track.layoutBoundsWidth - thumbWidth;
var thumbRange:number = this.track.layoutBoundsWidth - this.thumb.layoutBoundsWidth;
var range:number = this.maximum - this.minimum;
var thumbPosTrackX:number = (range > 0) ? ((this.pendingValue - this.minimum) / range) * thumbRange : 0;
var thumbPos:Point = this.track.localToGlobal(thumbPosTrackX, 0);
Expand All @@ -81,7 +80,7 @@ module egret {
if(this.showTrackHighlight&&this.trackHighlight&&this.trackHighlight.parent){
var trackHighlightX:number = this.trackHighlight.parent.globalToLocal(thumbPosX,thumbPosY,Point.identity).x-thumbPosTrackX;
this.trackHighlight.x = Math.round(trackHighlightX);
this.trackHighlight.width = Math.round(thumbPosTrackX+thumbWidth*0.5);
this.trackHighlight.width = Math.round(thumbPosTrackX);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension/gui/components/VSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ module egret {
this.thumb.setLayoutBoundsPosition(this.thumb.layoutBoundsX, Math.round(thumbPosParentY));
if(this.showTrackHighlight&&this.trackHighlight&&this.trackHighlight._parent){
var trackHighlightY:number = this.trackHighlight._parent.globalToLocal(thumbPosX,thumbPosY,Point.identity).y;
this.trackHighlight.y = Math.round(trackHighlightY+thumbHeight*0.5);
this.trackHighlight.height = Math.round(thumbRange-trackHighlightY+thumbHeight*0.5);
this.trackHighlight.y = Math.round(trackHighlightY+thumbHeight);
this.trackHighlight.height = Math.round(thumbRange-trackHighlightY);
}
}
}
Expand Down

0 comments on commit 43e0944

Please sign in to comment.