Skip to content

Commit

Permalink
feat: keep selection but hide during selecting
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Jan 29, 2024
1 parent 92d60dc commit 571551f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions assets/diagram-js.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ svg.new-parent {
pointer-events: none;
}

.djs-lasso-selection .djs-outline,
.djs-lasso-selection .djs-selection-outline,
.djs-lasso-selection .djs-context-pad {
display: none !important;
}

/**
* Resize styles
*/
Expand Down
6 changes: 6 additions & 0 deletions lib/features/lasso-tool/LassoTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {

var LASSO_TOOL_CURSOR = 'crosshair';

var LASSO_TOOL_SELECTING_CLS = 'djs-lasso-selection';

/**
* @param {EventBus} eventBus
* @param {Canvas} canvas
Expand Down Expand Up @@ -130,6 +132,8 @@ export default function LassoTool(

context.bbox = toBBox(event);
visuals.create(context);

canvas.addMarker(canvas.getRootElement(), LASSO_TOOL_SELECTING_CLS);
});

eventBus.on('lasso.move', function(event) {
Expand All @@ -145,6 +149,8 @@ export default function LassoTool(
var context = event.context;

visuals.remove(context);

canvas.removeMarker(canvas.getRootElement(), LASSO_TOOL_SELECTING_CLS);
});


Expand Down
13 changes: 12 additions & 1 deletion test/spec/features/lasso-tool/LassoToolSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,18 @@ describe('features/lasso-tool', function() {
dragging.move(canvasEvent({ x: 200, y: 300 }));

// then
expect(canvas._svg.querySelector('.djs-lasso-overlay')).to.exist;
expect(canvas.getContainer().querySelector('.djs-lasso-overlay')).to.exist;
}));


it('should indicate selecting', inject(function(lassoTool, canvas, dragging) {

// when
lassoTool.activateLasso(canvasEvent({ x: 100, y: 100 }));
dragging.move(canvasEvent({ x: 200, y: 300 }));

// then
expect(canvas.getContainer().querySelector('.djs-lasso-selection')).to.exist;
}));

});
Expand Down

0 comments on commit 571551f

Please sign in to comment.