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
8886bab3
Commit
8886bab3
authored
Feb 10, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zoomable' into 'develop'
add mouse-wheel-zoom See merge request romain.deleau/rlg-tool!2
parents
ef732a04
83c1ea36
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
9 deletions
+41
-9
app.component.html
src/app/app.component.html
+1
-3
app.component.scss
src/app/app.component.scss
+2
-0
app.module.ts
src/app/app.module.ts
+4
-2
drag-scroll.directive.ts
src/app/directives/drag-scroll.directive.ts
+4
-4
mouse-wheel-zoom.directive.spec.ts
src/app/directives/mouse-wheel-zoom.directive.spec.ts
+8
-0
mouse-wheel-zoom.directive.ts
src/app/directives/mouse-wheel-zoom.directive.ts
+22
-0
No files found.
src/app/app.component.html
View file @
8886bab3
<div
class=
"container"
>
<div
class=
"container-main"
appDragScroll
>
<div
class=
"container-main-scenario"
style=
"display: flex;"
>
<div
class=
"container-main-scenario"
style=
"display: flex;"
appMouseWheelZoom
>
<div
style=
"display: flex; flex-direction: column;"
[
style
.
z-index
]="
4
"
>
<app-game-educationnal-objective></app-game-educationnal-objective>
<app-game-context
[
style
.
z-index
]="
2
"
></app-game-context>
...
...
@@ -47,8 +47,6 @@
</div>
<div
class=
"container-sider-element"
style=
"width: 400px; height: 400px; background-color: green;"
>
</div>
</div>
...
...
src/app/app.component.scss
View file @
8886bab3
...
...
@@ -15,6 +15,8 @@
scrollbar-width
:
none
;
&
-scenario
{
position
:
relative
;
transform-origin
:
top
left
;
padding
:
60px
5px
10px
5px
;
margin-right
:
7px
;
}
...
...
src/app/app.module.ts
View file @
8886bab3
...
...
@@ -15,6 +15,7 @@ import { FormsModule } from '@angular/forms';
import
{
BrowserAnimationsModule
}
from
'@angular/platform-browser/animations'
;
import
{
MatIconModule
}
from
'@angular/material/icon'
;
import
{
DragScrollDirective
}
from
'./directives/drag-scroll.directive'
;
import
{
MouseWheelZoomDirective
}
from
'./directives/mouse-wheel-zoom.directive'
;
@
NgModule
({
declarations
:
[
...
...
@@ -26,7 +27,8 @@ import { DragScrollDirective } from './directives/drag-scroll.directive';
GameContextComponent
,
TaskComponent
,
AnnexeTaskComponent
,
DragScrollDirective
DragScrollDirective
,
MouseWheelZoomDirective
],
imports
:
[
BrowserModule
,
...
...
src/app/directives/drag-scroll.directive.ts
View file @
8886bab3
...
...
@@ -9,12 +9,12 @@ export class DragScrollDirective {
private
startY
:
number
=
0
;
private
element
:
HTMLElement
;
constructor
(
elementRef
:
ElementRef
)
{
constructor
(
private
elementRef
:
ElementRef
)
{
this
.
element
=
elementRef
.
nativeElement
;
}
@
HostListener
(
'mousedown'
,
[
'$event'
])
onMouseDown
(
event
:
any
)
{
onMouseDown
(
event
:
MouseEvent
)
{
this
.
isMouseDown
=
true
;
this
.
startX
=
event
.
clientX
;
this
.
startY
=
event
.
clientY
;
...
...
@@ -22,13 +22,13 @@ export class DragScrollDirective {
}
@
HostListener
(
'mouseup'
,
[
'$event'
])
onMouseUp
(
event
:
any
)
{
onMouseUp
(
event
:
MouseEvent
)
{
this
.
isMouseDown
=
false
;
this
.
element
.
style
.
cursor
=
'grab'
;
}
@
HostListener
(
'mousemove'
,
[
'$event'
])
onMouseMove
(
event
:
any
)
{
onMouseMove
(
event
:
MouseEvent
)
{
if
(
this
.
isMouseDown
)
{
event
.
preventDefault
();
const
x
=
event
.
clientX
-
this
.
startX
;
...
...
src/app/directives/mouse-wheel-zoom.directive.spec.ts
0 → 100644
View file @
8886bab3
import
{
MouseWheelZoomDirective
}
from
'./mouse-wheel-zoom.directive'
;
describe
(
'MouseWheelZoomDirective'
,
()
=>
{
it
(
'should create an instance'
,
()
=>
{
const
directive
=
new
MouseWheelZoomDirective
();
expect
(
directive
).
toBeTruthy
();
});
});
src/app/directives/mouse-wheel-zoom.directive.ts
0 → 100644
View file @
8886bab3
import
{
Directive
,
ElementRef
,
HostListener
}
from
'@angular/core'
;
@
Directive
({
selector
:
'[appMouseWheelZoom]'
})
export
class
MouseWheelZoomDirective
{
private
zoom
:
number
=
1
;
private
element
:
HTMLElement
;
constructor
(
private
elementRef
:
ElementRef
)
{
this
.
element
=
elementRef
.
nativeElement
;
}
@
HostListener
(
'wheel'
,
[
'$event'
])
onMouseWheel
(
event
:
WheelEvent
)
{
event
.
preventDefault
();
const
zoomLevel
=
event
.
deltaY
<
0
?
0.1
:
-
0.1
;
this
.
zoom
+=
zoomLevel
;
this
.
element
.
style
.
transform
=
`scale(
${
this
.
zoom
}
)`
;
}
}
\ 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