Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed deselecting widgets with ctrl + click #191

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) sort folders alphabetically in pages view
* (foxriver76) fixed deselecting widgets with ctrl + click

### 2.7.0 (2023-11-22)
* (foxriver76) implemented Basic Bar widget natively
Expand Down
29 changes: 15 additions & 14 deletions src/src/Vis/visBaseWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,22 +417,23 @@ class VisBaseWidget extends React.Component {
}
}

if (!this.props.selectedWidgets.includes(this.props.id)) {
if (e.shiftKey || e.ctrlKey) {
// add or remove
const pos = this.props.selectedWidgets.indexOf(this.props.id);
if (pos === -1) {
const selectedWidgets = [...this.props.selectedWidgets, this.props.id];
this.props.context.setSelectedWidgets(selectedWidgets);
} else {
const selectedWidgets = [...this.props.selectedWidgets];
selectedWidgets.splice(pos, 1);
this.props.context.setSelectedWidgets(selectedWidgets);
}
if (e.shiftKey || e.ctrlKey) {
// add or remove
const pos = this.props.selectedWidgets.indexOf(this.props.id);
if (pos === -1) {
const selectedWidgets = [...this.props.selectedWidgets, this.props.id];
this.props.context.setSelectedWidgets(selectedWidgets);
} else {
// set select
this.props.context.setSelectedWidgets([this.props.id]);
const selectedWidgets = [...this.props.selectedWidgets];
selectedWidgets.splice(pos, 1);
this.props.context.setSelectedWidgets(selectedWidgets);
}
return;
}

if (!this.props.selectedWidgets.includes(this.props.id)) {
// set select
this.props.context.setSelectedWidgets([this.props.id]);
} else if (this.props.moveAllowed && this.state.draggable !== false) {
if (!this.props.isRelative) {
// User can drag only objects of the same type
Expand Down
Loading