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
97e2c4d7
Commit
97e2c4d7
authored
Feb 09, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add drag scroll
parent
fe4390c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
36 deletions
+95
-36
app.component.html
src/app/app.component.html
+27
-27
app.component.scss
src/app/app.component.scss
+14
-7
app.module.ts
src/app/app.module.ts
+4
-2
drag-scroll.directive.spec.ts
src/app/directives/drag-scroll.directive.spec.ts
+8
-0
drag-scroll.directive.ts
src/app/directives/drag-scroll.directive.ts
+42
-0
No files found.
src/app/app.component.html
View file @
97e2c4d7
<div
class=
"container"
>
<div
class=
"container-main"
style=
"display: flex;"
>
<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>
</div>
<div
style=
"display: flex; flex-direction: column;"
[
style
.
z-index
]="
3
"
>
<app-educational-objective></app-educational-objective>
<app-mission-context
[
style
.
z-index
]="
2
"
></app-mission-context>
<div
class=
"container-main"
appDragScroll
>
<div
class=
"container-main-scenario"
style=
"display: flex;"
>
<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>
</div>
</div>
<div
style=
"display: flex; flex-direction: column;"
[
style
.
z-index
]="
3
"
>
<app-educational-objective></app-educational-objective>
<app-mission-context
[
style
.
z-index
]="
2
"
></app-mission-context>
</div>
<div
[
style
.
z-index
]="
2
"
>
<div
style=
"display: flex;"
>
<app-role
[
style
.
z-index
]="
10
"
></app-role>
<div
[
style
.
z-index
]="
1
"
>
<div
style=
"display: flex;"
[
style
.
z-index
]="
2
"
>
<app-task
[
style
.
z-index
]="
2
"
></app-task
>
<app-task
[
style
.
z-index
]="
1
"
></app-task>
<div
[
style
.
z-index
]="
2
"
>
<div
style=
"display: flex;"
>
<app-role
[
style
.
z-index
]="
10
"
></app-role>
<div
[
style
.
z-index
]="
1
"
>
<div
style=
"display: flex;"
[
style
.
z-index
]="
2
"
>
<app-task
[
style
.
z-index
]="
2
"
></app-task>
<app-task
[
style
.
z-index
]="
1
"
></app-task>
</div>
</div>
</div>
</div
>
<div
style=
"display: flex;"
>
<app-role
[
style
.
z-index
]="
10
"
></app-role
>
<div
[
style
.
z-index
]="
1
"
>
<div
style=
"display: flex;"
[
style
.
z-index
]="
2
"
>
<app-task
[
style
.
z-index
]="
2
"
></app-task
>
<
app-task
[
style
.
z-index
]="
1
"
></app-task>
<div
style=
"display: flex;"
>
<app-role
[
style
.
z-index
]="
10
"
></app-role
>
<div
[
style
.
z-index
]="
1
"
>
<div
style=
"display: flex;"
[
style
.
z-index
]="
2
"
>
<app-task
[
style
.
z-index
]="
2
"
></app-task
>
<app-task
[
style
.
z-index
]="
1
"
></app-task>
<
/div>
</div>
</div>
</div>
...
...
src/app/app.component.scss
View file @
97e2c4d7
...
...
@@ -4,16 +4,23 @@
flex-direction
:
row
;
&
-main
{
margin-top
:
60px
;
margin-right
:
20%
;
position
:
absolute
;
height
:
100%
;
width
:
100%
;
//width: 80%
;
//transform: scale(0.75)
;
//transform-origin: top left
;
width
:
calc
(
80%
-
5px
)
;
left
:
0
;
right
:
5px
;
top
:
0px
;
overflow
:
scroll
;
//overflow-y: visible;
-ms-overflow-style
:
none
;
scrollbar-width
:
none
;
&
-scenario
{
padding
:
60px
5px
10px
5px
;
margin-right
:
7px
;
}
}
&
-main
:
:-
webkit-scrollbar
{
display
:
none
;
}
&
-sider
{
...
...
src/app/app.module.ts
View file @
97e2c4d7
...
...
@@ -13,7 +13,8 @@ import { AnnexeTaskComponent } from './pieces/annexe-task/annexe-task.component'
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
BrowserAnimationsModule
}
from
'@angular/platform-browser/animations'
;
import
{
MatIconModule
}
from
'@angular/material/icon'
;
import
{
MatIconModule
}
from
'@angular/material/icon'
;
import
{
DragScrollDirective
}
from
'./directives/drag-scroll.directive'
;
@
NgModule
({
declarations
:
[
...
...
@@ -24,7 +25,8 @@ import { MatIconModule } from '@angular/material/icon';
GameEducationnalObjectiveComponent
,
GameContextComponent
,
TaskComponent
,
AnnexeTaskComponent
AnnexeTaskComponent
,
DragScrollDirective
],
imports
:
[
BrowserModule
,
...
...
src/app/directives/drag-scroll.directive.spec.ts
0 → 100644
View file @
97e2c4d7
import
{
DragScrollDirective
}
from
'./drag-scroll.directive'
;
describe
(
'DragScrollDirective'
,
()
=>
{
it
(
'should create an instance'
,
()
=>
{
const
directive
=
new
DragScrollDirective
();
expect
(
directive
).
toBeTruthy
();
});
});
src/app/directives/drag-scroll.directive.ts
0 → 100644
View file @
97e2c4d7
import
{
Directive
,
HostListener
,
ElementRef
}
from
'@angular/core'
;
@
Directive
({
selector
:
'[appDragScroll]'
})
export
class
DragScrollDirective
{
private
isMouseDown
:
boolean
=
false
;
private
startX
:
number
=
0
;
private
startY
:
number
=
0
;
private
element
:
HTMLElement
;
constructor
(
elementRef
:
ElementRef
)
{
this
.
element
=
elementRef
.
nativeElement
;
}
@
HostListener
(
'mousedown'
,
[
'$event'
])
onMouseDown
(
event
:
any
)
{
this
.
isMouseDown
=
true
;
this
.
startX
=
event
.
clientX
;
this
.
startY
=
event
.
clientY
;
this
.
element
.
style
.
cursor
=
'grabbing'
;
}
@
HostListener
(
'mouseup'
,
[
'$event'
])
onMouseUp
(
event
:
any
)
{
this
.
isMouseDown
=
false
;
this
.
element
.
style
.
cursor
=
'grab'
;
}
@
HostListener
(
'mousemove'
,
[
'$event'
])
onMouseMove
(
event
:
any
)
{
if
(
this
.
isMouseDown
)
{
event
.
preventDefault
();
const
x
=
event
.
clientX
-
this
.
startX
;
const
y
=
event
.
clientY
-
this
.
startY
;
this
.
element
.
scrollLeft
-=
x
;
this
.
element
.
scrollTop
-=
y
;
this
.
startX
=
event
.
clientX
;
this
.
startY
=
event
.
clientY
;
}
}
}
\ 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