Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
存储配置服务
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1b130e8f
authored
Jan 17, 2022
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改字幕高度计算方式
1 parent
9a899c4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
3 deletions
src/main/java/com/viontech/storage/entity/Generator.java
src/main/java/com/viontech/storage/entity/Generator.java
View file @
1b130e8
...
...
@@ -191,11 +191,11 @@ public class Generator {
if
(
j
==
0
&&
captionNode
.
getTop
()
!=
null
)
{
caption
=
captionNode
.
getTop
();
content
=
captionNode
.
getTopContent
();
height
=
String
.
valueOf
(
captionNode
.
getTopHeight
()
);
height
=
item
.
getMaxTopCaptionHeight
(
);
}
else
if
(
j
==
1
&&
captionNode
.
getBottom
()
!=
null
)
{
caption
=
captionNode
.
getBottom
();
content
=
captionNode
.
getBottomContent
();
height
=
String
.
valueOf
(
captionNode
.
getBottomHeight
()
);
height
=
item
.
getMaxBottomCaptionHeight
(
);
}
else
if
(
j
==
2
&&
captionNode
.
getSecond
()
!=
null
)
{
caption
=
captionNode
.
getSecond
();
content
=
captionNode
.
getSecondContent
();
...
...
@@ -406,6 +406,40 @@ public class Generator {
return
String
.
valueOf
(
maxPaddingTop
);
}
private
String
getMaxTopCaptionHeight
()
{
PicNode
node
=
this
;
int
maxTop
=
Integer
.
MIN_VALUE
;
while
(
node
!=
null
)
{
int
topHeight
=
node
.
getCaptionNode
().
getTopHeight
()
==
null
?
0
:
node
.
getCaptionNode
().
getTopHeight
();
maxTop
=
Math
.
max
(
maxTop
,
topHeight
);
node
=
node
.
getLeft
();
}
node
=
this
;
while
(
node
!=
null
)
{
int
topHeight
=
node
.
getCaptionNode
().
getTopHeight
()
==
null
?
0
:
node
.
getCaptionNode
().
getTopHeight
();
maxTop
=
Math
.
max
(
maxTop
,
topHeight
);
node
=
node
.
getRight
();
}
return
String
.
valueOf
(
maxTop
);
}
private
String
getMaxBottomCaptionHeight
()
{
PicNode
node
=
this
;
int
maxBottom
=
Integer
.
MIN_VALUE
;
while
(
node
!=
null
)
{
int
bottomHeight
=
node
.
getCaptionNode
().
getBottomHeight
()
==
null
?
0
:
node
.
getCaptionNode
().
getBottomHeight
();
maxBottom
=
Math
.
max
(
maxBottom
,
bottomHeight
);
node
=
node
.
getLeft
();
}
node
=
this
;
while
(
node
!=
null
)
{
int
bottomHeight
=
node
.
getCaptionNode
().
getBottomHeight
()
==
null
?
0
:
node
.
getCaptionNode
().
getBottomHeight
();
maxBottom
=
Math
.
max
(
maxBottom
,
bottomHeight
);
node
=
node
.
getRight
();
}
return
String
.
valueOf
(
maxBottom
);
}
/**
* 获取一个图片节点的左侧图片节点
*/
...
...
@@ -600,7 +634,7 @@ public class Generator {
String
dateFormat
=
(
vo
.
getMillisecond
()
!=
null
&&
vo
.
getMillisecond
())
?
vo
.
getDateFormat
()
+
".xxx"
:
vo
.
getDateFormat
();
Pair
<
String
,
Integer
>
pair
=
combineCaptionContent
(
vo
.
getPicType
(),
vo
.
getContexts
(),
dateFormat
);
Integer
wrapCount
=
pair
.
getValue
();
int
height
=
wrapCount
==
0
?
fontSize
+
10
:
(
wrapCount
+
1
)
*
(
fontSize
+
10
)
;
int
height
=
(
wrapCount
+
1
)
*
fontSize
+
10
;
switch
(
positionType
)
{
case
0
:
this
.
top
=
vo
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment