File tree Expand file tree Collapse file tree
packages/core/src/view/edge Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { createElement as h , Component , createRef } from 'preact/compat'
22import { Circle } from '../shape'
3+ import { isNil , isFunction } from 'lodash-es'
34import { LineText } from '../text'
45import LogicFlow from '../../LogicFlow'
56import { GraphModel , BaseEdgeModel , PolylineEdgeModel } from '../../model'
@@ -550,6 +551,15 @@ export abstract class BaseEdge<P extends IProps> extends Component<
550551 e,
551552 position,
552553 } )
554+ // 会偶现边点击后会马上失去焦点的问题,这里手动让节点获焦以解决这个问题
555+ const el = e . currentTarget as HTMLElement
556+ const rAF =
557+ ! isNil ( window ) && isFunction ( window . requestAnimationFrame )
558+ ? window . requestAnimationFrame . bind ( window )
559+ : ( fn : ( ) => void ) => setTimeout ( fn , 0 )
560+ rAF ( ( ) => {
561+ el . focus ( )
562+ } )
553563 }
554564 const { editConfigModel } = graphModel
555565 graphModel . selectEdgeById ( model . id , isMultipleSelect ( e , editConfigModel ) )
You can’t perform that action at this time.
0 commit comments