Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RLG Maker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Romain DELEAU
RLG Maker
Commits
36b282f5
Commit
36b282f5
authored
Oct 24, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix zoom problem / add scroll with directionnal arrow and quick save
parent
534f437f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
11 deletions
+52
-11
app.component.html
src/app/app.component.html
+2
-2
app.component.scss
src/app/app.component.scss
+1
-1
app.component.ts
src/app/app.component.ts
+25
-0
drag-scroll.directive.ts
src/app/directives/drag-scroll.directive.ts
+20
-0
mouse-wheel-zoom.directive.ts
src/app/directives/mouse-wheel-zoom.directive.ts
+4
-8
No files found.
src/app/app.component.html
View file @
36b282f5
<div
class=
"container"
>
<div
class=
"container-appDragScroll"
appDragScroll
>
<div
class=
"container-appMouseWheelZoom"
appMouseWheelZoom
>
<div
class=
"container-appDragScroll"
appDragScroll
appMouseWheelZoom
>
<div
class=
"container-appMouseWheelZoom"
>
<div
class=
"container-scenario-main"
>
<div
class=
"container-scenario-main-gamePieces"
[
style
.
z-index
]="
4
"
>
...
...
src/app/app.component.scss
View file @
36b282f5
...
...
@@ -13,6 +13,7 @@
overflow
:
scroll
;
-ms-overflow-style
:
none
;
scrollbar-width
:
none
;
user-select
:
none
;
}
&
-appDragScroll
:
:-
webkit-scrollbar
{
...
...
@@ -20,7 +21,6 @@
}
&
-appMouseWheelZoom
{
position
:
relative
;
transform-origin
:
top
left
;
padding
:
60px
5px
10px
5px
;
margin-right
:
7px
;
...
...
src/app/app.component.ts
View file @
36b282f5
...
...
@@ -75,6 +75,31 @@ export class AppComponent {
return
message
;
}
@
HostListener
(
'document:keydown'
,
[
'$event'
])
onKeyDown
(
event
:
KeyboardEvent
)
{
if
(
event
.
ctrlKey
&&
event
.
key
===
's'
)
{
event
.
preventDefault
();
let
fileName
:
string
=
this
.
scenario
.
projectName
;
if
(
this
.
scenario
.
projectName
==
''
)
{
fileName
=
"Scénario - RLG Maker"
;
this
.
titleService
.
setTitle
(
'RLG Maker'
);
}
else
{
fileName
=
this
.
scenario
.
projectName
+
' - RLG Maker'
;
this
.
titleService
.
setTitle
(
'RLG Maker - '
+
this
.
scenario
.
projectName
);
}
this
.
scenario
.
tooltips
=
this
.
tooltipService
.
activatedTooltips
;
this
.
scenario
.
traces
.
push
(
new
Trace
(
this
.
scenario
.
traces
.
length
,
'quick_save'
,
undefined
,
undefined
,
'all'
,
'Scenario'
));
const
jsonString
=
JSON
.
stringify
(
this
.
scenario
,
undefined
,
2
);
const
blob
=
new
Blob
([
jsonString
],
{
type
:
'application/json'
});
const
url
=
URL
.
createObjectURL
(
blob
);
const
link
=
document
.
createElement
(
'a'
);
link
.
download
=
fileName
;
link
.
href
=
url
;
link
.
click
();
URL
.
revokeObjectURL
(
url
);
}
}
downloadManual
():
void
{
const
manualUrl
=
'./assets/GuideMakerWeb_v2.0.pdf'
;
this
.
http
.
get
(
manualUrl
,
{
responseType
:
'blob'
}).
subscribe
((
blob
:
Blob
)
=>
{
...
...
src/app/directives/drag-scroll.directive.ts
View file @
36b282f5
...
...
@@ -39,4 +39,24 @@ export class DragScrollDirective {
this
.
startY
=
event
.
clientY
;
}
}
@
HostListener
(
'window:keydown'
,
[
'$event'
])
handleKeyDown
(
event
:
KeyboardEvent
)
{
if
(
document
.
activeElement
!
.
tagName
.
toLowerCase
()
!==
'input'
&&
document
.
activeElement
!
.
tagName
.
toLowerCase
()
!==
'textarea'
)
{
const
arrowKeys
=
[
'ArrowUp'
,
'ArrowDown'
,
'ArrowLeft'
,
'ArrowRight'
];
if
(
arrowKeys
.
includes
(
event
.
key
))
{
event
.
preventDefault
();
const
distance
=
50
;
if
(
event
.
key
===
'ArrowUp'
)
{
this
.
element
.
scrollBy
(
0
,
-
distance
);
}
else
if
(
event
.
key
===
'ArrowDown'
)
{
this
.
element
.
scrollBy
(
0
,
distance
);
}
else
if
(
event
.
key
===
'ArrowLeft'
)
{
this
.
element
.
scrollBy
(
-
distance
,
0
);
}
else
if
(
event
.
key
===
'ArrowRight'
)
{
this
.
element
.
scrollBy
(
distance
,
0
);
}
}
}
}
}
\ No newline at end of file
src/app/directives/mouse-wheel-zoom.directive.ts
View file @
36b282f5
...
...
@@ -7,11 +7,7 @@ import { MinimapService } from '../services/minimap/minimap.service';
})
export
class
MouseWheelZoomDirective
{
private
element
:
HTMLElement
;
constructor
(
private
elementRef
:
ElementRef
,
private
zoomService
:
ZoomService
,
private
minimapService
:
MinimapService
)
{
this
.
element
=
elementRef
.
nativeElement
;
}
constructor
(
private
elementRef
:
ElementRef
,
private
zoomService
:
ZoomService
,
private
minimapService
:
MinimapService
)
{
}
@
HostListener
(
'wheel'
,
[
'$event'
])
onMouseWheel
(
event
:
WheelEvent
)
{
...
...
@@ -19,13 +15,13 @@ export class MouseWheelZoomDirective {
let
zoomLevel
:
number
=
0
;
if
(
event
.
deltaY
<
0
)
{
if
(
this
.
zoomService
.
zoom
<
1.5
)
{
zoomLevel
=
0.
1
zoomLevel
=
0.
025
;
}
}
else
if
(
this
.
zoomService
.
zoom
>
0.3
)
{
zoomLevel
=
-
0.
1
zoomLevel
=
-
0.
025
;
}
this
.
zoomService
.
zoom
+=
zoomLevel
;
this
.
element
.
style
.
transform
=
`scale(
${
this
.
zoomService
.
zoom
}
)`
;
this
.
element
Ref
.
nativeElement
.
querySelector
(
'.container-appMouseWheelZoom'
)
.
style
.
transform
=
`scale(
${
this
.
zoomService
.
zoom
}
)`
;
this
.
minimapService
.
reset
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment