Skip to content

Commit

Permalink
fix: don't add djs-dragging class to non-diagram elements
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Nov 3, 2023
1 parent 67af6b8 commit ec29a7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
34 changes: 16 additions & 18 deletions lib/features/bendpoints/BendpointMovePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ var RECONNECT_START = 'reconnectStart',
RECONNECT_END = 'reconnectEnd',
UPDATE_WAYPOINTS = 'updateWaypoints';

var MARKER_OK = 'connect-ok',
MARKER_NOT_OK = 'connect-not-ok',
var MARKER_CONNECT_OK = 'connect-ok',
MARKER_CONNECT_NOT_OK = 'connect-not-ok',
MARKER_CONNECT_HOVER = 'connect-hover',
MARKER_CONNECT_UPDATING = 'djs-updating',
MARKER_DRAGGER = 'djs-dragging';
MARKER_UPDATING = 'djs-updating',
MARKER_DRAGGING = 'djs-dragging';

var HIGH_PRIORITY = 1100;

Expand Down Expand Up @@ -61,12 +61,10 @@ export default function BendpointMovePreview(bendpointMove, injector, eventBus,
connection.waypoints = newWaypoints;

// add dragger gfx
var draggerGfx = context.draggerGfx = addBendpoint(canvas.getLayer('overlays'));
context.draggerGfx = addBendpoint(canvas.getLayer('overlays'));

svgClasses(draggerGfx).add('djs-dragging');

canvas.addMarker(connection, MARKER_DRAGGER);
canvas.addMarker(connection, MARKER_CONNECT_UPDATING);
canvas.addMarker(connection, MARKER_DRAGGING);
canvas.addMarker(connection, MARKER_UPDATING);
});

eventBus.on('bendpoint.move.hover', function(event) {
Expand All @@ -83,11 +81,11 @@ export default function BendpointMovePreview(bendpointMove, injector, eventBus,
}

if (allowed) {
canvas.removeMarker(hover, MARKER_NOT_OK);
canvas.addMarker(hover, MARKER_OK);
canvas.removeMarker(hover, MARKER_CONNECT_NOT_OK);
canvas.addMarker(hover, MARKER_CONNECT_OK);
} else if (allowed === false) {
canvas.removeMarker(hover, MARKER_OK);
canvas.addMarker(hover, MARKER_NOT_OK);
canvas.removeMarker(hover, MARKER_CONNECT_OK);
canvas.addMarker(hover, MARKER_CONNECT_NOT_OK);
}
}
});
Expand All @@ -102,7 +100,7 @@ export default function BendpointMovePreview(bendpointMove, injector, eventBus,

if (hover) {
canvas.removeMarker(hover, MARKER_CONNECT_HOVER);
canvas.removeMarker(hover, target ? MARKER_OK : MARKER_NOT_OK);
canvas.removeMarker(hover, target ? MARKER_CONNECT_OK : MARKER_CONNECT_NOT_OK);
}
});

Expand Down Expand Up @@ -194,12 +192,12 @@ export default function BendpointMovePreview(bendpointMove, injector, eventBus,
// remove dragger gfx
svgRemove(draggerGfx);

canvas.removeMarker(connection, MARKER_CONNECT_UPDATING);
canvas.removeMarker(connection, MARKER_DRAGGER);
canvas.removeMarker(connection, MARKER_UPDATING);
canvas.removeMarker(connection, MARKER_DRAGGING);

if (hover) {
canvas.removeMarker(hover, MARKER_OK);
canvas.removeMarker(hover, target ? MARKER_OK : MARKER_NOT_OK);
canvas.removeMarker(hover, MARKER_CONNECT_OK);
canvas.removeMarker(hover, target ? MARKER_CONNECT_OK : MARKER_CONNECT_NOT_OK);
}

if (connectionPreview) {
Expand Down
1 change: 0 additions & 1 deletion lib/features/bendpoints/ConnectionSegmentMove.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ export default function ConnectionSegmentMove(

// add dragger gfx
context.draggerGfx = addSegmentDragger(layer, context.segmentStart, context.segmentEnd);
svgClasses(context.draggerGfx).add('djs-dragging');

canvas.addMarker(connection, MARKER_CONNECT_UPDATING);
});
Expand Down

0 comments on commit ec29a7e

Please sign in to comment.