Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tailorbird
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Künstlerische Gestaltung
Tailorbird
Commits
b5823c6e
Commit
b5823c6e
authored
May 2, 2023
by
Jakob Yanagibashi
Browse files
Options
Downloads
Patches
Plain Diff
Implement jump to key
parent
f99a9385
No related branches found
No related tags found
2 merge requests
!2
CI improvements
,
!1
Implement "Jump to" shortcut
Pipeline
#260485
passed
May 2, 2023
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.js
+24
-3
24 additions, 3 deletions
main.js
with
24 additions
and
3 deletions
main.js
+
24
−
3
View file @
b5823c6e
...
@@ -128,6 +128,7 @@ document.querySelector("#app").innerHTML = `
...
@@ -128,6 +128,7 @@ document.querySelector("#app").innerHTML = `
<li><i class="fa-solid fa-left-right"></i> <span class="helpControlText">Rotate horizontally: Drag</span></li>
<li><i class="fa-solid fa-left-right"></i> <span class="helpControlText">Rotate horizontally: Drag</span></li>
<li><i class="fa-solid fa-up-down"></i> <span class="helpControlText">Rotate vertically: Shift+Drag</span></li>
<li><i class="fa-solid fa-up-down"></i> <span class="helpControlText">Rotate vertically: Shift+Drag</span></li>
<li><i class="fa-solid fa-up-down-left-right"></i> <span class="helpControlText">Move: Opt/Alt+Drag</span></li>
<li><i class="fa-solid fa-up-down-left-right"></i> <span class="helpControlText">Move: Opt/Alt+Drag</span></li>
<li><i class="fa-solid fa-share fa-rotate-90"></i> <span class="helpControlText">Jump to: O</span></li>
</ul>
</ul>
</p>
</p>
<form method="dialog">
<form method="dialog">
...
@@ -513,14 +514,14 @@ function removeSelectedCommand() {
...
@@ -513,14 +514,14 @@ function removeSelectedCommand() {
/* 3D & UI */
/* 3D & UI */
function
initIllo
()
{
function
initIllo
()
{
window
.
illo
=
new
Zdog
.
Illustration
({
window
.
illo
=
new
Zdog
.
Illustration
({
element
:
"
.zdog-canvas
"
,
element
:
"
.zdog-canvas
"
,
scale
:
10
,
scale
:
10
,
centered
:
false
,
translate
:
{
x
:
400
,
y
:
400
},
resize
:
true
,
resize
:
true
,
rotate
:
{
x
:
Zdog
.
TAU
*
0.2
},
rotate
:
{
x
:
Zdog
.
TAU
*
0.2
},
});
});
// Wheel (zoom)
// Wheel (zoom)
window
.
illo
.
element
.
addEventListener
(
"
wheel
"
,
(
e
)
=>
{
window
.
illo
.
element
.
addEventListener
(
"
wheel
"
,
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -535,6 +536,7 @@ function initIllo() {
...
@@ -535,6 +536,7 @@ function initIllo() {
1
-
Math
.
max
(
Math
.
min
(
e
.
deltaY
/
40
,
0.9
),
-
0.9
)
1
-
Math
.
max
(
Math
.
min
(
e
.
deltaY
/
40
,
0.9
),
-
0.9
)
);
);
});
});
// Drag (move)
// Drag (move)
window
.
viewRotation
=
new
Zdog
.
Vector
();
window
.
viewRotation
=
new
Zdog
.
Vector
();
new
Zdog
.
Dragger
({
new
Zdog
.
Dragger
({
...
@@ -569,6 +571,25 @@ function initIllo() {
...
@@ -569,6 +571,25 @@ function initIllo() {
},
},
});
});
// O button (jump to)
window
.
addEventListener
(
"
keydown
"
,
(
event
)
=>
{
if
(
event
.
isComposing
||
event
.
key
!==
"
o
"
||
!
window
.
selectedListEntries
[
0
])
{
return
;
}
const
jumpCmd
=
window
.
selectedListEntries
[
0
];
if
(
!
"
goalx
"
in
jumpCmd
||
!
"
goaly
"
in
jumpCmd
)
{
return
;
}
var
illoTrans
=
new
Zdog
.
Vector
({
x
:
-
jumpCmd
.
goaly
.
value
*
window
.
illo
.
scale
.
x
,
y
:
-
jumpCmd
.
goalx
.
value
*
window
.
illo
.
scale
.
y
,
z
:
-
jumpCmd
.
goalz
.
value
*
window
.
illo
.
scale
.
z
,
});
illoTrans
.
rotate
(
window
.
illo
.
rotate
);
console
.
log
(
"
jump to X:
"
+
illoTrans
.
x
+
"
, Y:
"
+
illoTrans
.
y
);
window
.
illo
.
translate
=
illoTrans
;
});
window
.
currentProject
.
renderAll
();
window
.
currentProject
.
renderAll
();
animateIllo
();
animateIllo
();
...
@@ -740,7 +761,7 @@ function initEditEventListeners() {
...
@@ -740,7 +761,7 @@ function initEditEventListeners() {
}
}
// Add selection
// Add selection
if
(
e
.
target
&&
e
.
target
.
matches
(
"
li
"
))
{
if
(
e
.
target
&&
e
.
target
.
matches
(
"
li
"
))
{
window
.
selectedListEntry
=
e
.
target
;
//
window.selectedListEntry = e.target;
TEST for removal
e
.
target
.
command
.
addSelection
();
e
.
target
.
command
.
addSelection
();
window
.
selectedListEntries
.
push
(
e
.
target
.
command
);
window
.
selectedListEntries
.
push
(
e
.
target
.
command
);
}
}
...
...
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