@@ -113,7 +113,7 @@ class ArrowFollow extends Component<IProps, IState> {
113
113
const _start : [ v : VERTICAL , h : HORIZONTAL ] = props . start . corner . split ( '_' ) as unknown as [ v : VERTICAL , h : HORIZONTAL ] ;
114
114
const _end : [ v : VERTICAL , h : HORIZONTAL ] = props . end . corner . split ( '_' ) as unknown as [ v : VERTICAL , h : HORIZONTAL ] ;
115
115
116
- const { width, height } = this . _geCropView ( props , _start ) ;
116
+ const { width, height } = this . _geCropView ( props , _start , _end ) ;
117
117
118
118
const //
119
119
aspectRatio : IState [ 'aspectRatio' ] = height / width ,
@@ -140,9 +140,15 @@ class ArrowFollow extends Component<IProps, IState> {
140
140
* @param {IProps } props
141
141
* @param {VERTICAL } startVertical
142
142
* @param {HORIZONTAL } startHorizontal
143
+ * @param {VERTICAL } endVertical
144
+ * @param {HORIZONTAL } endHorizontal
143
145
* @return {{width:number, height:number} }
144
146
*/
145
- private _geCropView = ( props : IProps , [ startVertical , startHorizontal ] : [ v : VERTICAL , h : HORIZONTAL ] ) : { width : number ; height : number } => {
147
+ private _geCropView = (
148
+ props : IProps ,
149
+ [ startVertical , startHorizontal ] : [ v : VERTICAL , h : HORIZONTAL ] ,
150
+ [ endVertical , endHorizontal ] : [ v : VERTICAL , h : HORIZONTAL ]
151
+ ) : { width : number ; height : number } => {
146
152
const size = ( ( 1000 / props . width ) * ( props . size ?? 12 ) ) / 2 ;
147
153
const triangleWidth = ( ( size * 3 ) / 1000 ) * props . width ;
148
154
const triangleWidthMiddle = triangleWidth / 2 ;
@@ -171,10 +177,18 @@ class ArrowFollow extends Component<IProps, IState> {
171
177
}
172
178
}
173
179
} else {
174
- if ( props . start . direction === DIRECTION . HORIZONTAL ) {
175
- dimensionsView . height += triangleWidthMiddle ;
180
+ if ( startVertical === endVertical || startHorizontal === endHorizontal ) {
181
+ if ( props . start . direction === DIRECTION . HORIZONTAL ) {
182
+ dimensionsView . height += triangleWidthMiddle ;
183
+ } else {
184
+ dimensionsView . width += triangleWidthMiddle ;
185
+ }
176
186
} else {
177
- dimensionsView . width += triangleWidthMiddle ;
187
+ if ( props . start . direction === DIRECTION . HORIZONTAL ) {
188
+ dimensionsView . height += triangleWidthMiddle + self / 2 ;
189
+ } else {
190
+ dimensionsView . width += triangleWidthMiddle + self / 2 ;
191
+ }
178
192
}
179
193
}
180
194
@@ -225,7 +239,7 @@ class ArrowFollow extends Component<IProps, IState> {
225
239
margins . push ( { left : - self } ) ;
226
240
}
227
241
if ( startVertical === VERTICAL . TOP ) {
228
- margins . push ( { top : - self } ) ;
242
+ // margins.push({ top: -self });
229
243
} else {
230
244
margins . push ( { top : - triangleWidthMiddle } ) ;
231
245
}
0 commit comments