Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fyge_for_tb
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
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
王剑峰
fyge_for_tb
Commits
f49611da
Commit
f49611da
authored
May 27, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
2bfdba48
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
fyge.min.js
dist/fyge.min.js
+1
-1
fyge.min.js.map
dist/fyge.min.js.map
+1
-1
TextField.ts
src/2d/text/TextField.ts
+12
-11
No files found.
dist/fyge.min.js
View file @
f49611da
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/fyge.min.js.map
View file @
f49611da
This diff is collapsed.
Click to expand it.
src/2d/text/TextField.ts
View file @
f49611da
...
...
@@ -37,12 +37,12 @@ export class TextField extends Sprite {
var
canvas
=
createCanvas
()
// canvas.width = 3;
// canvas.height = 3;
if
(
osType
==
"ios"
)
{
//
if (osType == "ios") {
canvas
.
width
=
canvas
.
height
=
3
;
}
else
{
//现在只能用canvas2d渲染,所以不能用imageData了,等修复了安卓canvas尺寸问题再改
canvas
.
width
=
300
;
canvas
.
height
=
150
;
}
//
} else {//现在只能用canvas2d渲染,所以不能用imageData了,等修复了安卓canvas尺寸问题再改
//
canvas.width = 300;
//
canvas.height = 150;
//
}
this
.
texture
=
Texture
.
fromCanvas
(
canvas
,
"textCanvas"
);
this
.
canvas
=
canvas
;
this
.
context
=
canvas
.
getContext
(
"2d"
);
...
...
@@ -491,13 +491,13 @@ export class TextField extends Sprite {
s
.
dirty
=
false
;
//如果没有文本
if
(
!
s
.
_text
)
{
if
(
osType
==
"ios"
)
{
//
if (osType == "ios") {
s
.
canvas
.
width
=
0
;
s
.
canvas
.
height
=
0
;
}
else
{
//暂时不能用sourceData形式,所以和上面效果一样
s
.
texture
.
baseTexture
.
source
.
width
=
0
;
s
.
texture
.
baseTexture
.
source
.
height
=
0
;
}
//
} else {//暂时不能用sourceData形式,所以和上面效果一样
//
s.texture.baseTexture.source.width = 0;
//
s.texture.baseTexture.source.height = 0;
//
}
s
.
_localBoundsSelf
.
clear
();
s
.
anchorTexture
=
{
x
:
0
,
y
:
0
};
s
.
texture
.
update
()
...
...
@@ -582,6 +582,7 @@ export class TextField extends Sprite {
let
canHeight
=
maxH
+
padding
*
2
;
can
.
width
=
canWidth
can
.
height
=
canHeight
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
//在不能修改尺寸的时候,否则尺寸改变,上下文会初始化
ctx
.
clearRect
(
0
,
0
,
can
.
width
,
can
.
height
);
//安卓貌似无效,文案重叠了再处理,或者等修复了尺寸问题就好了
if
(
s
.
border
)
{
ctx
.
beginPath
();
...
...
@@ -606,7 +607,7 @@ export class TextField extends Sprite {
for
(
let
i
=
0
;
i
<
realLines
.
length
;
i
++
)
{
let
ox
=
0
;
//@ts-ignore 现在貌似小程序的textAlign有点问题,如果修复了再说
if
(
my
)
ox
=
-
tx
;
//移回去
// if (my) ox = - tx;//移回去,已经修复,注释掉吧
if
(
s
.
stroke
)
{
ctx
.
strokeStyle
=
s
.
strokeColor
;
ctx
.
lineWidth
=
s
.
stroke
*
2
;
...
...
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