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 {
...
@@ -202,7 +202,6 @@ export class TextField extends Sprite {
this
.
_lineSpacing
=
value
;
this
.
_lineSpacing
=
value
;
this
.
dirty
=
true
;
this
.
dirty
=
true
;
}
}
;
}
}
public
get
lineSpacing
():
number
{
public
get
lineSpacing
():
number
{
...
@@ -255,7 +254,7 @@ export class TextField extends Sprite {
...
@@ -255,7 +254,7 @@ export class TextField extends Sprite {
this
.
dirty
=
true
;
this
.
dirty
=
true
;
}
}
pr
ivate
_text
:
string
=
""
;
pr
otected
_text
:
string
=
""
;
/**
/**
* 文本的css字体样式
* 文本的css字体样式
...
@@ -321,7 +320,7 @@ export class TextField extends Sprite {
...
@@ -321,7 +320,7 @@ export class TextField extends Sprite {
return
this
.
_fillColor
;
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 {
...
@@ -63,11 +63,13 @@ class AdjustProxy {
onAddedToStage
(
e
)
{
onAddedToStage
(
e
)
{
this
.
_host
.
parent
.
addEventListener
(
Event
.
RESIZE
,
this
.
onResize
,
this
);
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
);
this
.
_host
.
addEventListener
(
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
}
}
onRemovedFromStage
(
e
)
{
onRemovedFromStage
(
e
)
{
this
.
_host
.
parent
.
removeEventListener
(
Event
.
RESIZE
,
this
.
onResize
);
this
.
_host
.
parent
.
removeEventListener
(
Event
.
RESIZE
,
this
.
onResize
);
this
.
_host
.
removeEventListener
(
Event
.
RESIZE
,
this
.
onResize
,
this
);
this
.
_host
.
removeEventListener
(
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
);
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";
...
@@ -6,6 +6,7 @@ import Texture from "../../../2d/texture/Texture";
import
{
getAssetByName
,
getAssetByUUID
}
from
"../assets-manager"
;
import
{
getAssetByName
,
getAssetByUUID
}
from
"../assets-manager"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
Event
}
from
"../../../2d/events"
;
const
assetScheme
=
'asset://'
;
const
assetScheme
=
'asset://'
;
...
@@ -49,23 +50,27 @@ export class Image extends Sprite {
...
@@ -49,23 +50,27 @@ export class Image extends Sprite {
}
}
private
_setSource
(
value
){
private
_setSource
(
value
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
value
!==
this
.
_source
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
this
.
_registeredEvents
.
push
(
eventName
);
}
this
.
onDataMutated
();
}
else
{
this
.
_setSourceDirect
(
value
);
}
}
this
.
onDataMutated
();
}
else
{
this
.
dispatchEvent
(
Event
.
RESIZE
);
this
.
_setSourceDirect
(
value
);
}
}
}
}
...
...
src/zeroing/game-warpper/nodes/Label.ts
View file @
fbb51781
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
{
TextField
}
from
"../../../2d/text"
;
import
{
TextField
}
from
"../../../2d/text"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
dataCenter
}
from
"../data-center"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
ESCAPE_REG_EXP
}
from
"../../utils"
;
import
{
Event
}
from
"../../../2d/events"
;
/**
/**
* 文本
* 文本
...
@@ -19,23 +20,27 @@ export class Label extends TextField {
...
@@ -19,23 +20,27 @@ export class Label extends TextField {
* @private
* @private
*/
*/
protected
_setText
(
value
)
{
protected
_setText
(
value
)
{
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
value
!==
this
.
_text
){
let
matchResult
=
value
.
match
(
ESCAPE_REG_EXP
);
if
(
matchResult
)
{
if
(
matchResult
)
{
this
.
unregisterEvents
();
this
.
unregisterEvents
();
this
.
_originText
=
value
;
this
.
_originText
=
value
;
this
.
_escapes
.
splice
(
0
);
this
.
_escapes
.
splice
(
0
);
for
(
let
item
of
matchResult
)
{
for
(
let
item
of
matchResult
)
{
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
escape
=
item
.
substr
(
2
,
item
.
length
-
3
);
let
args
=
escape
.
split
(
'|'
);
let
args
=
escape
.
split
(
'|'
);
let
eventName
=
args
[
0
];
let
eventName
=
args
[
0
];
this
.
_escapes
.
push
(
escape
);
this
.
_escapes
.
push
(
escape
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
dataCenter
.
addEventListener
(
eventName
,
this
.
onDataMutated
,
this
);
this
.
_registeredEvents
.
push
(
eventName
);
this
.
_registeredEvents
.
push
(
eventName
);
}
this
.
onDataMutated
();
}
else
{
super
.
_setText
(
value
);
}
}
this
.
onDataMutated
();
}
else
{
this
.
dispatchEvent
(
Event
.
RESIZE
);
super
.
_setText
(
value
);
}
}
}
}
...
...
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