File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -196,19 +196,21 @@ class RulerView extends React.Component<IRuler & IProps, IState> {
196
196
}
197
197
198
198
private split = ( direction : SplitDirection ) => ( ) => {
199
- const isHorizontal = direction === SplitDirection . HORIZONTAL ;
200
- const newWidth = isHorizontal ? this . state . width : this . state . width / 2 ;
201
- const newHeight = isHorizontal ? this . state . height / 2 : this . state . height ;
199
+ const isSplitHorizontally = direction === SplitDirection . HORIZONTAL ;
200
+ const width = this . state . width * ( isSplitHorizontally ? 1 : 0.5 ) ;
201
+ const height = this . state . height * ( isSplitHorizontally ? 0.5 : 1 ) ;
202
+ const x = isSplitHorizontally ? this . state . x : this . state . x + width ;
203
+ const y = isSplitHorizontally ? this . state . y + height : this . state . y ;
202
204
203
- this . setState ( resize ( newWidth , newHeight ) , ( ) => {
205
+ this . setState ( resize ( width , height ) , ( ) => {
204
206
setPositionInDOM ( this . el . current , this . state . x , this . state . y ) ;
205
207
this . props . split (
206
208
direction ,
207
209
this . props . id ,
208
- isHorizontal ? this . state . x : this . state . x + newWidth ,
209
- isHorizontal ? this . state . y + newHeight : this . state . y ,
210
- newWidth ,
211
- newHeight ,
210
+ x ,
211
+ y ,
212
+ width ,
213
+ height ,
212
214
this . props . color
213
215
) ;
214
216
} ) ;
You can’t perform that action at this time.
0 commit comments