Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
355a2a7b
Commit
355a2a7b
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented deletion with selection box
parent
3a1890ec
No related branches found
No related tags found
No related merge requests found
Pipeline
#52782
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
editor/js/tools/deletetool.js
+17
-5
17 additions, 5 deletions
editor/js/tools/deletetool.js
with
17 additions
and
5 deletions
editor/js/tools/deletetool.js
+
17
−
5
View file @
355a2a7b
...
@@ -21,7 +21,7 @@ export default class DeleteTool extends Tool {
...
@@ -21,7 +21,7 @@ export default class DeleteTool extends Tool {
onBoxSelect
(
left
,
bottom
,
top
,
right
)
{
onBoxSelect
(
left
,
bottom
,
top
,
right
)
{
// Filter out selected nodes
// Filter out selected nodes
const
hit
Nodes
=
[];
const
selected
Nodes
=
[];
const
tl
=
renderer
.
screen2GraphCoords
(
left
,
top
);
const
tl
=
renderer
.
screen2GraphCoords
(
left
,
top
);
const
br
=
renderer
.
screen2GraphCoords
(
right
,
bottom
);
const
br
=
renderer
.
screen2GraphCoords
(
right
,
bottom
);
graph
.
data
[
Graph
.
GRAPH_NODES
].
forEach
((
node
)
=>
{
graph
.
data
[
Graph
.
GRAPH_NODES
].
forEach
((
node
)
=>
{
...
@@ -31,13 +31,25 @@ export default class DeleteTool extends Tool {
...
@@ -31,13 +31,25 @@ export default class DeleteTool extends Tool {
br
.
y
>
node
.
y
&&
br
.
y
>
node
.
y
&&
node
.
y
>
tl
.
y
node
.
y
>
tl
.
y
)
{
)
{
hit
Nodes
.
push
(
node
);
selected
Nodes
.
push
(
node
);
}
}
});
});
// Delete selected items after confirmation
// Was anything even selected?
console
.
log
(
"
DELETE
"
);
if
(
selectedNodes
.
length
<=
0
)
{
console
.
log
(
hitNodes
);
return
;
}
// Ask for confirmation to delete
var
nodeNames
=
selectedNodes
.
map
((
n
)
=>
n
[
Graph
.
NODE_LABEL
]);
//! Problem: If browser is not actually showing the alerts, it always returns false!
var
shouldDelete
=
confirm
(
"
Do you wanna delete all these nodes:
\n\n
"
+
nodeNames
.
join
(
"
\n
"
))
// Delete if confirmed
if
(
shouldDelete
)
{
var
nodeIds
=
selectedNodes
.
map
((
n
)
=>
n
[
Graph
.
NODE_ID
]);
graph
.
deleteNodes
(
nodeIds
);
}
}
}
onNodeClick
(
node
)
{
onNodeClick
(
node
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment