Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
renderingEngine
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
王剑峰
renderingEngine
Commits
fbb51781
Commit
fbb51781
authored
Nov 29, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
有内容的节点内容变化后也要调整节点
parent
d48d3204
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
33 deletions
+44
-33
TextField.ts
src/2d/text/TextField.ts
+2
-3
auto-adjust.ts
src/zeroing/decorators/auto-adjust.ts
+2
-0
Image.ts
src/zeroing/game-warpper/nodes/Image.ts
+20
-15
Label.ts
src/zeroing/game-warpper/nodes/Label.ts
+20
-15
No files found.
src/2d/text/TextField.ts
View file @
fbb51781
...
...
@@ -202,7 +202,6 @@ export class TextField extends Sprite {
this
.
_lineSpacing
=
value
;
this
.
dirty
=
true
;
}
;
}
public
get
lineSpacing
():
number
{
...
...
@@ -255,7 +254,7 @@ export class TextField extends Sprite {
this
.
dirty
=
true
;
}
pr
ivate
_text
:
string
=
""
;
pr
otected
_text
:
string
=
""
;
/**
* 文本的css字体样式
...
...
@@ -321,7 +320,7 @@ export class TextField extends Sprite {
return
this
.
_fillColor
;
}
private
_fillColor
:
any
=
"#
ffffff
"
;
private
_fillColor
:
any
=
"#
000
"
;
/**
* 文本的描边颜色值
...
...
src/zeroing/decorators/auto-adjust.ts
View file @
fbb51781
...
...
@@ -63,11 +63,13 @@ class AdjustProxy {
onAddedToStage
(
e
)
{
this
.
_host
.
parent
.
addEventListener
(
Event
.
RESIZE
,
this
.
onResize
,
this
);
this
.
_host
.
addEventListener
(
Event
.
RESIZE
,
this
.
onResize
,
this
);
this
.
_host
.
addEventListener
(
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
}
onRemovedFromStage
(
e
)
{
this
.
_host
.
parent
.
removeEventListener
(
Event
.
RESIZE
,
this
.
onResize
);
this
.
_host
.
removeEventListener
(
Event
.
RESIZE
,
this
.
onResize
,
this
);
this
.
_host
.
removeEventListener
(
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
);
}
...
...
src/zeroing/game-warpper/nodes/Image.ts
View file @
fbb51781
...
...
@@ -6,6 +6,7 @@ import Texture from "../../../2d/texture/Texture";
import
{
getAssetByName
,
getAssetByUUID
}
from
"../assets-manager"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
Event
}
from
"../../../2d/events"
;
const
assetScheme
=
'asset://'
;
...
...
@@ -49,23 +50,27 @@ export class Image extends Sprite {
}
private
_setSource
(
value
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
value
!==
this
.
_source
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
}
this
.
onDataMutated
();
}
else
{
this
.
_setSourceDirect
(
value
);
}
this
.
onDataMutated
();
}
else
{
this
.
_setSourceDirect
(
value
);
this
.
dispatchEvent
(
Event
.
RESIZE
);
}
}
...
...
src/zeroing/game-warpper/nodes/Label.ts
View file @
fbb51781
...
...
@@ -4,6 +4,7 @@
import
{
TextField
}
from
"../../../2d/text"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
Event
}
from
"../../../2d/events"
;
/**
* 文本
...
...
@@ -19,23 +20,27 @@ export class Label extends TextField {
* @private
*/
protected
_setText
(
value
)
{
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
value
!==
this
.
_text
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
}
this
.
onDataMutated
();
}
else
{
super
.
_setText
(
value
);
}
this
.
onDataMutated
();
}
else
{
super
.
_setText
(
value
);
this
.
dispatchEvent
(
Event
.
RESIZE
);
}
}
...
...
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