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
917ec8e7
Commit
917ec8e7
authored
2 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implements special case handling to avoid incorrectly triggered background click event
parent
e690cc3f
No related branches found
No related tags found
1 merge request
!2
Implemented editor in the react framework
Pipeline
#56893
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/editor/js/components/editor.tsx
+14
-0
14 additions, 0 deletions
src/editor/js/components/editor.tsx
with
14 additions
and
0 deletions
src/editor/js/components/editor.tsx
+
14
−
0
View file @
917ec8e7
...
@@ -144,6 +144,20 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
...
@@ -144,6 +144,20 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
* @param event Click event.
* @param event Click event.
*/
*/
private
handleBackgroundClick
(
event
:
any
,
position
:
clickPosition
)
{
private
handleBackgroundClick
(
event
:
any
,
position
:
clickPosition
)
{
// Is there really no node there? Trying to prevent small error, where this event is triggered, even if there is a node.
const
placeholderNode
:
Node
=
{
id
:
undefined
,
x
:
position
.
graph
.
x
,
y
:
position
.
graph
.
y
,
}
as
unknown
as
Node
;
const
nearestNode
=
this
.
state
.
graph
.
getClosestOtherNode
(
placeholderNode
);
if
(
nearestNode
!==
undefined
&&
nearestNode
.
distance
<
4
)
{
console
.
log
(
"
Saved node click event
"
);
this
.
handleNodeClick
(
nearestNode
.
node
);
return
;
}
const
newNode
=
new
Node
();
const
newNode
=
new
Node
();
newNode
.
label
=
"
Unnamed
"
;
newNode
.
label
=
"
Unnamed
"
;
...
...
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