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
49d2d05e
You need to sign in or sign up before continuing.
Commit
49d2d05e
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented simple prototype connect tool menu
parent
74fcfba3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
editor/editor.php
+10
-1
10 additions, 1 deletion
editor/editor.php
editor/js/tools/connecttool.js
+7
-1
7 additions, 1 deletion
editor/js/tools/connecttool.js
editor/js/tools/menus/connectmenu.js
+15
-0
15 additions, 0 deletions
editor/js/tools/menus/connectmenu.js
with
32 additions
and
2 deletions
editor/editor.php
+
10
−
1
View file @
49d2d05e
...
...
@@ -2,7 +2,16 @@
<h1>
Interface
</h1>
<div
id=
"2d-graph"
></div>
<section
id=
"toolbar"
></section>
<section
id=
"tool-menu"
class=
"hidden"
></section>
<section
id=
"tool-menu"
>
<div
id=
"connect-menu"
class=
"hidden"
>
<label
for=
"link-type"
>
Link Type
</label>
<select
id=
"link-type"
name=
"link-type"
>
<option
value=
"Vorlesung"
>
Lecture
</option>
<option
value=
"Algorithmus"
>
Algorithm
</option>
<option
value=
"Definition"
>
Definition
</option>
</select>
</div>
</section>
<section>
<h3
id=
"selected-item"
>
Nothing selected
</h3>
<ul
id=
"selected-params"
></ul>
...
...
This diff is collapsed.
Click to expand it.
editor/js/tools/connecttool.js
+
7
−
1
View file @
49d2d05e
import
Tool
from
"
./tool
"
;
import
{
graph
,
state
}
from
"
../editor
"
;
import
*
as
Graph
from
"
../graph
"
;
import
ConnectMenu
from
"
./menus/connectmenu
"
;
const
KEEP_SOURCE_KEY_ID
=
17
;
...
...
@@ -8,6 +9,7 @@ export default class ConnectTool extends Tool {
constructor
(
key
)
{
super
(
"
Connect two nodes
"
,
"
connect
"
,
key
);
this
.
keepSource
=
false
;
this
.
menu
=
new
ConnectMenu
(
this
);
}
onNodeClick
(
node
)
{
...
...
@@ -21,9 +23,13 @@ export default class ConnectTool extends Tool {
}
// Add new link
var
details
=
{};
details
[
Graph
.
LINK_TYPE
]
=
this
.
menu
.
value
(
"
link-type
"
);
var
link
=
graph
.
addLink
(
state
.
selectedItem
[
Graph
.
NODE_ID
],
node
[
Graph
.
NODE_ID
]
node
[
Graph
.
NODE_ID
],
details
);
if
(
link
===
undefined
)
{
...
...
This diff is collapsed.
Click to expand it.
editor/js/tools/menus/connectmenu.js
+
15
−
0
View file @
49d2d05e
import
ToolMenu
from
"
./toolmenu
"
;
const
LINK_TYPE_SEL
=
"
#link-type
"
;
export
default
class
ConnectMenu
extends
ToolMenu
{
constructor
(
tool
)
{
super
(
tool
);
}
beforeGet
(
key
)
{
if
(
key
===
"
link-type
"
)
{
return
this
.
getChildren
(
LINK_TYPE_SEL
).
val
();
}
}
}
\ No newline at end of file
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