@@ -120,6 +120,9 @@ export class ToolBase {
120120
121121 private checkProperty : boolean = true ;
122122
123+ /** @private */
124+ public isConnectionChangeStarted : boolean = false ;
125+
123126 protected undoParentElement : SelectorModel = { nodes : [ ] , connectors : [ ] } ;
124127
125128 protected undoContainerElement : SelectorModel = { nodes : [ ] , connectors : [ ] } ;
@@ -496,6 +499,8 @@ export class ConnectTool extends ToolBase {
496499
497500 /** @private */
498501 public selectedSegment : BezierSegment ;
502+ /** @private - tracks whether the connector endpoint actually moved during the change */
503+ protected connectionChangeMoved : boolean = false ;
499504
500505 constructor ( commandHandler : CommandHandler , endPoint : string ) {
501506 super ( commandHandler , true ) ;
@@ -575,14 +580,15 @@ export class ConnectTool extends ToolBase {
575580 this . checkPropertyValue ( ) ;
576581 this . commandHandler . updateSelector ( ) ;
577582 this . commandHandler . removeSnap ( ) ;
578- if ( args . source && ( args . source as SelectorModel ) . connectors && ( ! ( this instanceof ConnectorDrawingTool ) ) && ( ( this . endPoint === 'ConnectorSourceEnd' &&
583+ //1010806: Incorrect state Values in sourcePointChange and targetPointChange Events
584+ if ( ( args . source && ( args . source as SelectorModel ) . connectors && ( ! ( this instanceof ConnectorDrawingTool ) ) && ( ( this . endPoint === 'ConnectorSourceEnd' &&
579585 ( args . source as SelectorModel ) . connectors . length &&
580586 ( ( ! Point . equals ( ( args . source as SelectorModel ) . connectors [ 0 ] . sourcePoint , this . undoElement . connectors [ 0 ] . sourcePoint ) ||
581587 ( ( args . source as SelectorModel ) . connectors [ 0 ] . sourceID !== this . undoElement . connectors [ 0 ] . sourceID ) ) ) ) ||
582588 ( this . endPoint === 'ConnectorTargetEnd' &&
583589 ( ( ! Point . equals ( ( args . source as SelectorModel ) . connectors [ 0 ] . targetPoint , this . undoElement . connectors [ 0 ] . targetPoint ) )
584- || ( ( args . source as SelectorModel ) . connectors [ 0 ] . targetID !== this . undoElement . connectors [ 0 ] . targetID ) ) ) ) ) {
585-
590+ || ( ( args . source as SelectorModel ) . connectors [ 0 ] . targetID !== this . undoElement . connectors [ 0 ] . targetID ) ) ) ) ) ||
591+ ( this . isConnectionChangeStarted && this . connectionChangeMoved && args . source && ( args . source as SelectorModel ) . connectors ) ) {
586592 let oldValues : PointModel ; let newValues : PointModel ; let connector : ConnectorModel ;
587593 if ( args . source && ( args . source as SelectorModel ) . connectors && this . endPoint === 'ConnectorSourceEnd' ) {
588594 //941055: The sourcePointChange event's old and new values are the same
@@ -625,6 +631,7 @@ export class ConnectTool extends ToolBase {
625631 this . commandHandler . addHistoryEntry ( entry ) ;
626632 }
627633 const trigger : number = this . endPoint === 'ConnectorSourceEnd' ? DiagramEvent . sourcePointChange : DiagramEvent . targetPointChange ;
634+ this . isConnectionChangeStarted = false ;
628635 this . commandHandler . triggerEvent ( trigger , arg ) ;
629636 //this.commandHandler.removeTerminalSegment(connector as Connector, true);
630637 } else if ( ! ( this instanceof ConnectorDrawingTool ) &&
@@ -657,7 +664,7 @@ export class ConnectTool extends ToolBase {
657664 public mouseMove ( args : MouseEventArgs ) : boolean {
658665 super . mouseMove ( args ) ;
659666 let tempArgs : IBlazorConnectionChangeEventArgs ;
660- if ( ( ! ( this instanceof ConnectorDrawingTool ) ) && ( ( this . endPoint === 'ConnectorSourceEnd' &&
667+ if ( ! this . isConnectionChangeStarted && ! this . connectionChangeMoved && ( ! ( this instanceof ConnectorDrawingTool ) ) && ( ( this . endPoint === 'ConnectorSourceEnd' &&
661668 Point . equals ( ( args . source as SelectorModel ) . connectors [ 0 ] . sourcePoint , this . undoElement . connectors [ 0 ] . sourcePoint ) ) ||
662669 ( this . endPoint === 'ConnectorTargetEnd' &&
663670 Point . equals ( ( args . source as SelectorModel ) . connectors [ 0 ] . targetPoint , this . undoElement . connectors [ 0 ] . targetPoint ) ) ) ) {
@@ -674,6 +681,7 @@ export class ConnectTool extends ToolBase {
674681 // eslint-disable-next-line @typescript-eslint/no-unused-expressions
675682 ( target instanceof PointPort || target instanceof BpmnSubEvent ) ? targetPort = target . id : targetNode = target . id ;
676683 }
684+ this . isConnectionChangeStarted = true ;
677685 let arg : IEndChangeEventArgs = {
678686 connector : connectors , state : 'Start' , targetNode : targetNode ,
679687 oldValue : oldValue , newValue : oldValue , cancel : false , targetPort : targetPort
@@ -709,6 +717,8 @@ export class ConnectTool extends ToolBase {
709717 const trigger : number = this . endPoint === 'ConnectorSourceEnd' ?
710718 DiagramEvent . sourcePointChange : DiagramEvent . targetPointChange ;
711719 this . commandHandler . triggerEvent ( trigger , arg ) ;
720+ // mark that the connector endpoint has moved at least once during this interaction
721+ this . connectionChangeMoved = true ;
712722 }
713723 if ( args . target ) {
714724 inPort = getInOutConnectPorts ( ( args . target as Node ) , true ) ; outPort = getInOutConnectPorts ( ( args . target as Node ) , false ) ;
@@ -883,6 +893,7 @@ export class ConnectTool extends ToolBase {
883893 super . endAction ( ) ;
884894 this . prevPosition = null ;
885895 this . endPoint = null ;
896+ this . connectionChangeMoved = false ;
886897 }
887898}
888899
@@ -1415,7 +1426,9 @@ export class MoveTool extends ToolBase {
14151426 }
14161427 if ( isSame && ! isBlazor ( ) ) {
14171428 this . commandHandler . triggerEvent ( DiagramEvent . positionChange , arg ) ;
1418- this . connectorEndPointChangeEvent ( arg ) ;
1429+ if ( ! this . isStartAction ) {
1430+ this . connectorEndPointChangeEvent ( arg ) ;
1431+ }
14191432 this . isStartAction = true ;
14201433 }
14211434 this . commandHandler . diagram . cancelPositionChange = arg . cancel ;
@@ -1450,7 +1463,9 @@ export class MoveTool extends ToolBase {
14501463 this . commandHandler . triggerEvent ( DiagramEvent . positionChange , arg ) ;
14511464 this . commandHandler . diagram . cancelPositionChange = arg . cancel ;
14521465 this . canTrigger = true ;
1453- this . connectorEndPointChangeEvent ( arg , snappedPoint ) ;
1466+ if ( this . isStartAction && arg . state !== 'Start' ) {
1467+ this . connectorEndPointChangeEvent ( arg , snappedPoint ) ;
1468+ }
14541469 if ( ! arg . cancel && ! this . canCancel ) {
14551470 this . blocked = ! this . commandHandler . dragSelectedObjects ( snappedPoint . x , snappedPoint . y ) ;
14561471 const blocked : boolean = ! ( this . commandHandler . mouseOver ( this . currentElement , this . currentTarget , this . currentPosition ) ) ;
0 commit comments