Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_4-1
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
JM_4-1
Commits
25c7050a
Commit
25c7050a
authored
Sep 28, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 结算界面卡住
parent
ba29541b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
37 deletions
+64
-37
Unit.ts
src/app/play/Unit.ts
+49
-19
play.component.ts
src/app/play/play.component.ts
+15
-18
No files found.
src/app/play/Unit.ts
View file @
25c7050a
...
...
@@ -870,7 +870,8 @@ export class RichText extends Label {
getSubTextRect
(
subText
,
targetIndex
=
0
)
{
this
.
isShowWordBg
=
true
;
this
.
update
();
const
tmpLabel
=
new
RichText
();
...
...
@@ -881,18 +882,20 @@ export class RichText extends Label {
tmpLabel
.
fontWeight
=
this
.
fontWeight
;
tmpLabel
.
width
=
this
.
width
;
tmpLabel
.
height
=
this
.
height
;
// console.log('subText: ', subT
ext);
console
.
log
(
'
subText:
'
,
subText
);
console
.
log
(
'
this.text:
'
,
this
.
t
ext
);
// const indexArr = searchSubStr(this.text, subText);
// console.log('indexArr: ', indexArr);
// const index = indexArr[targetIndex];
const
index
=
this
.
text
.
indexOf
(
subText
,
targetIndex
);
if
(
!
index
)
{
console
.
log
(
'
index:
'
,
index
);
if
(
index
==
-
1
)
{
return
;
}
console
.
log
(
'
this.wordBgData:
'
,
this
.
wordBgData
);
// const index = this.text.indexOf(subText);
// console.log('!!!index: ', index);
...
...
@@ -2122,8 +2125,9 @@ export class ScrollView extends MySprite {
refreshContentSize
()
{
const
children
=
this
.
content
.
children
;
console
.
log
(
'
children:
'
,
children
);
//
console.log('children: ', children);
let
maxW
=
0
;
let
maxH
=
0
;
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
@@ -2131,11 +2135,11 @@ export class ScrollView extends MySprite {
continue
;
}
const
box
=
children
[
i
].
getBoundingBox
();
console
.
log
(
'
box:
'
,
box
);
//
console.log('box: ', box);
const
boxEdgeX
=
box
.
x
+
box
.
width
;
const
boxEdgeY
=
box
.
y
+
box
.
height
;
console
.
log
(
'
boxEdgeY:
'
,
boxEdgeY
);
//
console.log('boxEdgeY: ', boxEdgeY);
if
(
boxEdgeX
>
maxW
)
{
maxW
=
boxEdgeX
;
}
...
...
@@ -2144,11 +2148,15 @@ export class ScrollView extends MySprite {
}
}
console
.
log
(
'
maxW:
'
,
maxW
);
console
.
log
(
'
maxH:
'
,
maxH
);
// console.log('maxW: ', maxW);
// console.log('maxH: ', maxH);
// console.log('this.y: ', this.y);
// console.log(this.getBoundingBox().height);
this
.
content
.
width
=
maxW
;
this
.
content
.
height
=
maxH
;
this
.
refreshScrollBar
();
}
...
...
@@ -2159,6 +2167,7 @@ export class ScrollView extends MySprite {
setContentScale
(
s
)
{
this
.
content
.
setScaleXY
(
1
/
s
);
this
.
refreshScrollBar
();
}
refreshScrollBar
()
{
...
...
@@ -2166,15 +2175,21 @@ export class ScrollView extends MySprite {
if
(
!
w
)
{
w
=
this
.
width
/
50
;
}
const
rect1
=
this
.
getBoundingBox
();
const
rect2
=
this
.
content
.
getBoundingBox
();
let
rate
=
this
.
height
*
this
.
scaleY
/
this
.
content
.
height
/
this
.
content
.
scaleY
;
// let rate = rect1.height / rect2.height;
let
rate
=
this
.
height
/
this
.
content
.
height
;
// let rate = this.height * this.scaleY / this.content.height / this.content.scaleY;
if
(
rate
>=
1
)
{
this
.
_scrollBar
.
visible
=
false
;
rate
=
1
;
}
else
{
this
.
_scrollBar
.
visible
=
true
;
}
const
h
=
rate
*
this
.
height
const
h
=
rate
*
(
this
.
height
)
const
r
=
w
/
2
;
this
.
_scrollBar
.
setSize
(
w
,
h
,
r
);
...
...
@@ -2182,7 +2197,12 @@ export class ScrollView extends MySprite {
}
refreshScrollBarPos
()
{
this
.
_scrollBar
.
y
=
-
this
.
content
.
y
*
(
this
.
height
/
this
.
content
.
height
);
const
rect1
=
this
.
getBoundingBox
();
const
rect2
=
this
.
content
.
getBoundingBox
();
let
rate
=
rect1
.
height
/
rect2
.
height
;
this
.
_scrollBar
.
y
=
-
rect2
.
y
*
(
rate
);
}
...
...
@@ -2212,9 +2232,12 @@ export class ScrollView extends MySprite {
}
onTouchMove
(
x
,
y
)
{
if
(
!
this
.
touchStartPos
)
{
return
;
}
if
(
!
this
.
touchStartContentPos
)
{
return
;
}
...
...
@@ -2222,10 +2245,12 @@ export class ScrollView extends MySprite {
const
offsetX
=
x
-
this
.
touchStartPos
.
x
;
const
offsetY
=
y
-
this
.
touchStartPos
.
y
;
const
rect
=
this
.
getBoundingBox
();
if
(
this
.
scrollSide
==
ScrollView
.
ScrollSideType
.
VERTICAL
)
{
this
.
content
.
y
=
between
(
this
.
touchStartContentPos
.
y
+
offsetY
,
0
,
this
.
getBoundingBox
()
.
height
-
this
.
content
.
height
);
this
.
content
.
y
=
between
(
this
.
touchStartContentPos
.
y
+
offsetY
,
0
,
-
rect
.
y
+
rect
.
height
-
this
.
content
.
height
);
}
else
{
this
.
content
.
x
=
between
(
this
.
touchStartContentPos
.
x
+
offsetX
,
0
,
this
.
getBoundingBox
().
width
-
this
.
content
.
width
);
this
.
content
.
x
=
between
(
this
.
touchStartContentPos
.
x
+
offsetX
,
0
,
-
rect
.
x
+
rect
.
width
-
this
.
content
.
width
);
}
this
.
refreshScrollBarPos
();
}
...
...
@@ -2239,10 +2264,12 @@ export class ScrollView extends MySprite {
if
(
!
this
.
_scrollBar
.
visible
)
{
return
;
}
const
rect
=
this
.
getBoundingBox
();
if
(
this
.
scrollSide
==
ScrollView
.
ScrollSideType
.
VERTICAL
)
{
this
.
content
.
y
=
between
(
this
.
content
.
y
+
40
,
0
,
this
.
getBoundingBox
()
.
height
-
this
.
content
.
height
);
this
.
content
.
y
=
between
(
this
.
content
.
y
+
40
,
0
,
-
rect
.
y
+
rect
.
height
-
this
.
content
.
height
);
}
else
{
this
.
content
.
x
=
between
(
this
.
content
.
x
+
40
,
0
,
this
.
getBoundingBox
()
.
width
-
this
.
content
.
width
);
this
.
content
.
x
=
between
(
this
.
content
.
x
+
40
,
0
,
-
rect
.
x
+
rect
.
width
-
this
.
content
.
width
);
}
this
.
refreshScrollBarPos
();
...
...
@@ -2252,10 +2279,13 @@ export class ScrollView extends MySprite {
if
(
!
this
.
_scrollBar
.
visible
)
{
return
;
}
const
rect
=
this
.
getBoundingBox
();
if
(
this
.
scrollSide
==
ScrollView
.
ScrollSideType
.
VERTICAL
)
{
this
.
content
.
y
=
between
(
this
.
content
.
y
-
40
,
0
,
this
.
getBoundingBox
()
.
height
-
this
.
content
.
height
);
this
.
content
.
y
=
between
(
this
.
content
.
y
-
40
,
0
,
-
rect
.
y
+
rect
.
height
-
this
.
content
.
height
);
}
else
{
this
.
content
.
x
=
between
(
this
.
content
.
x
-
40
,
0
,
this
.
getBoundingBox
()
.
width
-
this
.
content
.
width
);
this
.
content
.
x
=
between
(
this
.
content
.
x
-
40
,
0
,
-
rect
.
x
+
rect
.
width
-
this
.
content
.
width
);
}
this
.
refreshScrollBarPos
();
...
...
src/app/play/play.component.ts
View file @
25c7050a
This diff is collapsed.
Click to expand it.
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