@@ -39,37 +39,37 @@ export class Foreground extends GroupComponent<ForegroundCfg> {
3939 protected renderInner ( group : IGroup ) {
4040 const { x, height, width, foregroundStyle, barStyle } = this . cfg ;
4141
42- // 上方brush区域
42+ // 上方移动区域
4343 this . addShape ( group , {
44- id : this . getElementId ( 'foreground-brush ' ) ,
45- name : 'foreground-brush ' ,
44+ id : this . getElementId ( 'foreground-scroll ' ) ,
45+ name : 'foreground-scroll ' ,
4646 type : 'rect' ,
4747 attrs : {
4848 x,
4949 y : 0 ,
5050 width,
51- height : ( height * 3 ) / 5 ,
52- cursor : 'crosshair ' ,
51+ height : ( height * 2 ) / 5 ,
52+ cursor : 'move ' ,
5353 ...omit ( foregroundStyle , [ 'stroke' ] ) ,
5454 } ,
5555 } ) ;
5656
57- // 下方移动区域
57+ // 下方brush区域
5858 this . addShape ( group , {
59- id : this . getElementId ( 'foreground-scroll ' ) ,
60- name : 'foreground-scroll ' ,
59+ id : this . getElementId ( 'foreground-brush ' ) ,
60+ name : 'foreground-brush ' ,
6161 type : 'rect' ,
6262 attrs : {
6363 x,
64- y : ( height * 3 ) / 5 ,
64+ y : ( height * 2 ) / 5 ,
6565 width,
66- height : ( height * 2 ) / 5 ,
67- cursor : 'move ' ,
66+ height : ( height * 3 ) / 5 ,
67+ cursor : 'crosshair ' ,
6868 ...omit ( foregroundStyle , [ 'stroke' ] ) ,
6969 } ,
7070 } ) ;
7171
72- // 下方Bar区域
72+ // 上方Bar区域
7373 const barGroup = this . addGroup ( group , {
7474 id : this . getElementId ( 'foreground-bar' ) ,
7575 name : 'foreground-bar' ,
@@ -81,19 +81,19 @@ export class Foreground extends GroupComponent<ForegroundCfg> {
8181 type : 'rect' ,
8282 attrs : {
8383 x,
84- y : height ,
84+ y : - barStyle . height ,
8585 width,
8686 height : barStyle . height ,
8787 cursor : 'move' ,
88- ...barStyle ,
88+ ...omit ( barStyle , [ 'stroke' ] ) ,
8989 } ,
9090 } ) ;
9191 // 三条小竖线
9292 const centerX = width / 2 + x ;
9393 const leftX = centerX - SLIDER_BAR_LINE_GAP ;
9494 const rightX = centerX + SLIDER_BAR_LINE_GAP ;
95- const y1 = height + ( 1 / 4 ) * barStyle . height ;
96- const y2 = height + ( 3 / 4 ) * barStyle . height ;
95+ const y1 = - ( 1 / 4 ) * barStyle . height ;
96+ const y2 = - ( 3 / 4 ) * barStyle . height ;
9797 const publicAttrs = {
9898 y1,
9999 y2,
@@ -103,6 +103,7 @@ export class Foreground extends GroupComponent<ForegroundCfg> {
103103 this . drawBarLine ( group , x , publicAttrs ) ;
104104 } ) ;
105105
106+ // 背景边框
106107 this . addShape ( group , {
107108 id : this . getElementId ( 'foreground-border' ) ,
108109 name : 'foreground-border' ,
@@ -122,7 +123,7 @@ export class Foreground extends GroupComponent<ForegroundCfg> {
122123 private drawBarLine ( group : IGroup , x : number , attrs : LooseObject ) {
123124 this . addShape ( group , {
124125 id : this . getElementId ( `line-${ x } ` ) ,
125- name : `line- ${ x } ` ,
126+ name : `foreground-line ` ,
126127 type : 'line' ,
127128 attrs : {
128129 x1 : x ,
@@ -143,10 +144,18 @@ export class Foreground extends GroupComponent<ForegroundCfg> {
143144 barRectShape . attr ( 'fill' , highLightFill ) ;
144145 this . draw ( ) ;
145146 } ) ;
147+ this . get ( 'group' ) . on ( 'foreground-scroll:mouseenter' , ( ) => {
148+ barRectShape . attr ( 'fill' , highLightFill ) ;
149+ this . draw ( ) ;
150+ } ) ;
146151 this . get ( 'group' ) . on ( 'foreground-bar:mouseleave' , ( ) => {
147152 barRectShape . attr ( 'fill' , fill ) ;
148153 this . draw ( ) ;
149154 } ) ;
155+ this . get ( 'group' ) . on ( 'foreground-scroll:mouseleave' , ( ) => {
156+ barRectShape . attr ( 'fill' , fill ) ;
157+ this . draw ( ) ;
158+ } ) ;
150159 }
151160
152161 private draw ( ) {
0 commit comments