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
fa9d11c7
Commit
fa9d11c7
authored
3 years ago
by
Matthias Konitzny
Browse files
Options
Downloads
Patches
Plain Diff
Moved DRAG_THRESHOLD_2D to config.js
parent
ca4b89d1
No related branches found
No related tags found
No related merge requests found
Pipeline
#52693
passed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config.js
+1
-0
1 addition, 0 deletions
config.js
editor/js/editor.js
+18
-15
18 additions, 15 deletions
editor/js/editor.js
with
19 additions
and
15 deletions
config.js
+
1
−
0
View file @
fa9d11c7
...
@@ -20,3 +20,4 @@ export function setSpace(space) {
...
@@ -20,3 +20,4 @@ export function setSpace(space) {
}
}
export
const
DRAG_THRESHOLD_3D
=
10
;
export
const
DRAG_THRESHOLD_3D
=
10
;
export
const
DRAG_THRESHOLD_2D
=
5
;
This diff is collapsed.
Click to expand it.
editor/js/editor.js
+
18
−
15
View file @
fa9d11c7
...
@@ -3,13 +3,11 @@ import * as Graph from "./graph";
...
@@ -3,13 +3,11 @@ import * as Graph from "./graph";
import
{
loadGraphJson
}
from
"
../../datasets/datasets
"
;
import
{
loadGraphJson
}
from
"
../../datasets/datasets
"
;
import
ForceGraph
from
"
force-graph
"
;
import
ForceGraph
from
"
force-graph
"
;
import
*
as
Interactions
from
"
./interactions
"
;
import
*
as
Interactions
from
"
./interactions
"
;
import
{
setSpace
,
SPACE
}
from
"
../../config
"
;
import
{
DRAG_THRESHOLD_2D
,
setSpace
,
SPACE
}
from
"
../../config
"
;
export
var
state
=
undefined
;
export
var
state
=
undefined
;
export
var
graph
=
undefined
;
export
var
graph
=
undefined
;
var
graphObj
;
var
graphObj
;
export
const
DRAG_THRESHOLD_2D
=
5
;
window
.
onload
=
function
()
{
window
.
onload
=
function
()
{
// Only execute, if corresponding dom is present
// Only execute, if corresponding dom is present
...
@@ -25,21 +23,19 @@ window.onload = function () {
...
@@ -25,21 +23,19 @@ window.onload = function () {
loadSpace
(
SPACE
);
loadSpace
(
SPACE
);
};
};
export
function
loadSpace
(
spaceId
)
{
export
function
loadSpace
(
spaceId
)
{
if
(
state
!==
undefined
&&
spaceId
===
SPACE
)
{
if
(
state
!==
undefined
&&
spaceId
===
SPACE
)
{
return
;
return
;
}
}
setSpace
(
spaceId
);
setSpace
(
spaceId
);
return
loadGraphJson
(
SPACE
)
return
loadGraphJson
(
SPACE
).
then
((
graphConfig
)
=>
{
.
then
((
graphConfig
)
=>
{
state
=
new
State
();
state
=
new
State
();
graph
=
new
Graph
.
Graph
(
graphConfig
);
graph
=
new
Graph
.
Graph
(
graphConfig
);
load
();
load
();
graph
.
restartSimulation
();
graph
.
restartSimulation
();
});
});
}
}
function
extractPositions
(
event
)
{
function
extractPositions
(
event
)
{
...
@@ -72,9 +68,13 @@ function load() {
...
@@ -72,9 +68,13 @@ function load() {
state
.
onBackgroundClick
(
event
,
extractPositions
(
event
))
state
.
onBackgroundClick
(
event
,
extractPositions
(
event
))
)
)
.
nodeCanvasObjectMode
((
node
)
=>
state
.
nodeCanvasObjectMode
(
node
))
.
nodeCanvasObjectMode
((
node
)
=>
state
.
nodeCanvasObjectMode
(
node
))
.
nodeCanvasObject
((
node
,
ctx
,
globalScale
)
=>
state
.
nodeCanvasObject
(
node
,
ctx
,
globalScale
))
.
nodeCanvasObject
((
node
,
ctx
,
globalScale
)
=>
state
.
nodeCanvasObject
(
node
,
ctx
,
globalScale
)
)
.
linkCanvasObjectMode
((
link
)
=>
state
.
linkCanvasObjectMode
(
link
))
.
linkCanvasObjectMode
((
link
)
=>
state
.
linkCanvasObjectMode
(
link
))
.
linkCanvasObject
((
link
,
ctx
,
globalScale
)
=>
state
.
linkCanvasObject
(
link
,
ctx
,
globalScale
))
.
linkCanvasObject
((
link
,
ctx
,
globalScale
)
=>
state
.
linkCanvasObject
(
link
,
ctx
,
globalScale
)
)
.
onLinkClick
((
link
)
=>
state
.
onLinkClick
(
link
));
.
onLinkClick
((
link
)
=>
state
.
onLinkClick
(
link
));
graph
.
onChangeCallbacks
.
push
((
data
)
=>
{
graph
.
onChangeCallbacks
.
push
((
data
)
=>
{
...
@@ -83,7 +83,10 @@ function load() {
...
@@ -83,7 +83,10 @@ function load() {
}
}
function
onNodeDragEnd
(
node
,
translate
)
{
function
onNodeDragEnd
(
node
,
translate
)
{
if
(
Math
.
sqrt
(
Math
.
pow
(
translate
.
x
,
2
)
+
Math
.
pow
(
translate
.
y
,
2
))
<
DRAG_THRESHOLD_2D
)
{
if
(
state
.
onNodeClick
(
node
)
Math
.
sqrt
(
Math
.
pow
(
translate
.
x
,
2
)
+
Math
.
pow
(
translate
.
y
,
2
))
<
DRAG_THRESHOLD_2D
)
{
state
.
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