Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-17
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
YM5-17
Commits
a7a2b357
Commit
a7a2b357
authored
Apr 28, 2021
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:优化滚动条显示
parent
22c2789e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
Scrollbar.ts
src/app/play/Scrollbar.ts
+18
-0
play.component.ts
src/app/play/play.component.ts
+19
-2
No files found.
src/app/play/Scrollbar.ts
View file @
a7a2b357
...
...
@@ -162,4 +162,22 @@ export class Scrollbar {
this
.
scrollbar
.
y
=
newY
;
}
isTop
(){
if
(
this
.
scrollbar
.
y
==
this
.
scrollbarInitY
){
return
true
;
}
else
{
return
false
;
}
}
isBottom
(){
if
(
this
.
scrollbar
.
y
==
this
.
scrollbarInitY
+
this
.
canMoveDis
){
return
true
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
a7a2b357
...
...
@@ -984,7 +984,9 @@ export class PlayComponent implements OnInit, OnDestroy {
private
setShowRow
()
{
for
(
let
i
=
0
;
i
<
this
.
sentenceArr
.
length
;
++
i
){
let
len
=
this
.
sentenceArr
.
length
;
for
(
let
i
=
0
;
i
<
len
;
++
i
){
let
sentence
=
this
.
sentenceArr
[
i
];
...
...
@@ -994,7 +996,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
offsetY
=
Math
.
floor
(
y
-
h
/
2
);
if
(
offsetY
<
Math
.
floor
(
this
.
initY
)
||
(
offsetY
+
Math
.
floor
(
h
))
>
Math
.
floor
(
this
.
initY
+
this
.
sentenceBg
.
height
)){
if
(
offsetY
<
Math
.
floor
(
this
.
initY
-
5
*
this
.
mapScale
)
||
(
offsetY
+
Math
.
floor
(
h
))
>
Math
.
floor
(
this
.
initY
+
this
.
sentenceBg
.
height
)){
sentence
.
visible
=
false
;
this
.
indexLabelArr
[
i
].
visible
=
false
;
}
...
...
@@ -1004,6 +1006,21 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
if
(
len
>
0
){
//如果到达顶部,则默认显示第一行
if
(
this
.
scrollbar
.
isTop
()){
this
.
sentenceArr
[
0
].
visible
=
true
;
this
.
indexLabelArr
[
0
].
visible
=
true
;
}
else
if
(
this
.
scrollbar
.
isBottom
()){
this
.
sentenceArr
[
len
-
1
].
visible
=
true
;
this
.
indexLabelArr
[
len
-
1
].
visible
=
true
;
}
}
}
}
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