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
4ce59702
Commit
4ce59702
authored
Oct 09, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 换行
parent
7f8fa9b6
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
Unit.ts
src/app/play/Unit.ts
+18
-11
play.component.ts
src/app/play/play.component.ts
+5
-2
No files found.
src/app/play/Unit.ts
View file @
4ce59702
...
...
@@ -838,7 +838,6 @@ export class RichTextOld extends Label {
export
class
RichText
extends
Label
{
...
...
@@ -870,10 +869,6 @@ export class RichText extends Label {
getSubTextRect
(
subText
,
targetIndex
=
0
)
{
this
.
isShowWordBg
=
true
;
this
.
update
();
const
tmpLabel
=
new
RichText
();
tmpLabel
.
fontSize
=
this
.
fontSize
;
tmpLabel
.
fontName
=
this
.
fontName
;
...
...
@@ -882,20 +877,18 @@ export class RichText extends Label {
tmpLabel
.
fontWeight
=
this
.
fontWeight
;
tmpLabel
.
width
=
this
.
width
;
tmpLabel
.
height
=
this
.
height
;
console
.
log
(
'
subText:
'
,
subText
);
console
.
log
(
'
this.text:
'
,
this
.
t
ext
);
// console.log('subText: ', subT
ext);
// const indexArr = searchSubStr(this.text, subText);
// console.log('indexArr: ', indexArr);
// const index = indexArr[targetIndex];
const
index
=
this
.
text
.
indexOf
(
subText
,
targetIndex
);
console
.
log
(
'
index:
'
,
index
);
if
(
index
==
-
1
)
{
if
(
!
index
)
{
return
;
}
console
.
log
(
'
this.wordBgData:
'
,
this
.
wordBgData
);
// const index = this.text.indexOf(subText);
// console.log('!!!index: ', index);
...
...
@@ -907,6 +900,20 @@ export class RichText extends Label {
return
data
;
tmpLabel
.
text
=
this
.
text
.
substring
(
0
,
index
);
tmpLabel
.
refreshSize
();
const
x
=
tmpLabel
.
width
;
tmpLabel
.
text
=
subText
;
tmpLabel
.
refreshSize
();
const
width
=
tmpLabel
.
width
;
const
y
=
this
.
fontSize
/
2
;
const
height
=
this
.
fontSize
;
return
{
x
,
y
,
width
,
height
}
}
...
...
src/app/play/play.component.ts
View file @
4ce59702
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