From 43e09443d5c2d4f5ced42fb0d3bdb4d68c4ec6cd Mon Sep 17 00:00:00 2001 From: DOM Date: Tue, 3 Jun 2014 12:49:30 +0800 Subject: [PATCH] =?UTF-8?q?Slider=E9=AB=98=E4=BA=AE=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension/gui/components/HSlider.ts | 5 ++--- src/extension/gui/components/VSlider.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/extension/gui/components/HSlider.ts b/src/extension/gui/components/HSlider.ts index 63e61c1448..ed22bd277d 100644 --- a/src/extension/gui/components/HSlider.ts +++ b/src/extension/gui/components/HSlider.ts @@ -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); @@ -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); } } } diff --git a/src/extension/gui/components/VSlider.ts b/src/extension/gui/components/VSlider.ts index dcb513a994..4e3c1f72a1 100644 --- a/src/extension/gui/components/VSlider.ts +++ b/src/extension/gui/components/VSlider.ts @@ -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); } } }