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
620d3045
Commit
620d3045
authored
Dec 05, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复遮罩嵌套问题
修改滚动方向
parent
e0aba4ed
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
49 deletions
+73
-49
engine.js
debug/engine.js
+33
-19
engine.js.map
debug/engine.js.map
+1
-1
const.ts
src/2d/const.ts
+4
-1
StencilManager.ts
src/2d/renderers/managers/StencilManager.ts
+3
-0
TextField.ts
src/2d/text/TextField.ts
+2
-2
ScrollContainer.ts
src/2d/ui/ScrollContainer.ts
+30
-26
No files found.
debug/engine.js
View file @
620d3045
...
@@ -541,6 +541,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -541,6 +541,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
})(
exports
.
GC_MODES
||
(
exports
.
GC_MODES
=
{}));
})(
exports
.
GC_MODES
||
(
exports
.
GC_MODES
=
{}));
var
URL_FILE_EXTENSION
=
/
\.(\w{3,4})(?:
$|
\?
|#
)
/i
;
var
URL_FILE_EXTENSION
=
/
\.(\w{3,4})(?:
$|
\?
|#
)
/i
;
var
DATA_URI
=
/^
\s
*data:
(?:([\w
-
]
+
)\/([\w
+.-
]
+
))?(?:
;charset=
([\w
-
]
+
))?(?:
;
(
base64
))?
,
(
.*
)
/i
;
var
DATA_URI
=
/^
\s
*data:
(?:([\w
-
]
+
)\/([\w
+.-
]
+
))?(?:
;charset=
([\w
-
]
+
))?(?:
;
(
base64
))?
,
(
.*
)
/i
;
(
function
(
SCROLL_DIRECTION
)
{
SCROLL_DIRECTION
[
"HORIZONTAL"
]
=
"horizontal"
;
SCROLL_DIRECTION
[
"VERTICAL"
]
=
"vertical"
;
})(
exports
.
SCROLL_DIRECTION
||
(
exports
.
SCROLL_DIRECTION
=
{}));
var
Matrix
=
(
function
(
_super
)
{
var
Matrix
=
(
function
(
_super
)
{
tslib_1
.
__extends
(
Matrix
,
_super
);
tslib_1
.
__extends
(
Matrix
,
_super
);
...
@@ -6742,9 +6746,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -6742,9 +6746,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
gl
.
colorMask
(
false
,
false
,
false
,
false
);
gl
.
colorMask
(
false
,
false
,
false
,
false
);
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
graphics
.
renderable
=
true
;
graphics
.
renderable
=
true
;
var
tempAlpha
=
graphics
.
worldAlpha
;
graphics
.
worldAlpha
=
1
;
graphics
.
renderWebGL
(
this
.
renderer
);
graphics
.
renderWebGL
(
this
.
renderer
);
this
.
renderer
.
batchManager
.
flush
();
this
.
renderer
.
batchManager
.
flush
();
graphics
.
renderable
=
false
;
graphics
.
renderable
=
false
;
graphics
.
worldAlpha
=
tempAlpha
;
this
.
_useCurrent
();
this
.
_useCurrent
();
}
}
};
};
...
@@ -10324,7 +10331,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -10324,7 +10331,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this
.
_textAlign
=
exports
.
TEXT_ALIGN
.
LEFT
;
_this
.
_textAlign
=
exports
.
TEXT_ALIGN
.
LEFT
;
_this
.
_verticalAlign
=
exports
.
VERTICAL_ALIGN
.
UP
;
_this
.
_verticalAlign
=
exports
.
VERTICAL_ALIGN
.
UP
;
_this
.
_lineSpacing
=
14
;
_this
.
_lineSpacing
=
14
;
_this
.
_lineType
=
exports
.
TEXT_lINETYPE
.
MULTI
;
_this
.
_lineType
=
exports
.
TEXT_lINETYPE
.
SINGLE
;
_this
.
_text
=
""
;
_this
.
_text
=
""
;
_this
.
_font
=
"Arial"
;
_this
.
_font
=
"Arial"
;
_this
.
_size
=
12
;
_this
.
_size
=
12
;
...
@@ -11068,11 +11075,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -11068,11 +11075,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
ScrollContainer
=
(
function
(
_super
)
{
var
ScrollContainer
=
(
function
(
_super
)
{
tslib_1
.
__extends
(
ScrollContainer
,
_super
);
tslib_1
.
__extends
(
ScrollContainer
,
_super
);
function
ScrollContainer
(
maxDistance
,
isVertical
,
isFull
)
{
function
ScrollContainer
(
maxDistance
,
isFull
)
{
if
(
isVertical
===
void
0
)
{
isVertical
=
true
;
}
if
(
isFull
===
void
0
)
{
isFull
=
false
;
}
if
(
isFull
===
void
0
)
{
isFull
=
false
;
}
var
_this
=
_super
.
call
(
this
)
||
this
;
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
isVertical
=
true
;
_this
.
distance
=
0
;
_this
.
distance
=
0
;
_this
.
minDis
=
0
;
_this
.
minDis
=
0
;
_this
.
maskObj
=
new
Graphics
();
_this
.
maskObj
=
new
Graphics
();
...
@@ -11097,7 +11102,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -11097,7 +11102,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s
.
maskObj
.
isUsedToMask
=
false
;
s
.
maskObj
.
isUsedToMask
=
false
;
}
}
s
.
maskObj
.
alpha
=
0
;
s
.
maskObj
.
alpha
=
0
;
s
.
updateViewRect
(
isVertical
);
s
.
updateViewRect
();
s
.
direction
=
exports
.
SCROLL_DIRECTION
.
VERTICAL
;
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
)
{
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
)
{
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
});
...
@@ -11188,23 +11194,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -11188,23 +11194,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable
:
true
,
enumerable
:
true
,
configurable
:
true
configurable
:
true
});
});
ScrollContainer
.
prototype
.
updateViewRect
=
function
(
isVertical
)
{
Object
.
defineProperty
(
ScrollContainer
.
prototype
,
"direction"
,
{
get
:
function
()
{
return
this
.
_direction
;
},
set
:
function
(
value
)
{
this
.
_direction
=
value
;
var
s
=
this
;
if
(
value
===
exports
.
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
distance
=
s
.
height
;
s
.
paramXY
=
"y"
;
}
else
{
s
.
distance
=
s
.
width
;
s
.
paramXY
=
"x"
;
}
},
enumerable
:
true
,
configurable
:
true
});
ScrollContainer
.
prototype
.
updateViewRect
=
function
()
{
var
s
=
this
;
var
s
=
this
;
s
.
maskObj
.
clear
();
s
.
maskObj
.
clear
();
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
s
.
maskObj
.
endFill
();
s
.
maskObj
.
endFill
();
if
(
isVertical
!==
undefined
)
{
s
.
isVertical
=
isVertical
;
}
if
(
isVertical
)
{
s
.
distance
=
s
.
height
;
s
.
paramXY
=
"y"
;
}
else
{
s
.
distance
=
s
.
width
;
s
.
paramXY
=
"x"
;
}
};
};
ScrollContainer
.
prototype
.
onMouseEvent
=
function
(
e
)
{
ScrollContainer
.
prototype
.
onMouseEvent
=
function
(
e
)
{
var
s
=
this
;
var
s
=
this
;
...
@@ -11216,7 +11230,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -11216,7 +11230,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if
(
s
.
autoScroll
)
{
if
(
s
.
autoScroll
)
{
s
.
autoScroll
=
false
;
s
.
autoScroll
=
false
;
}
}
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
exports
.
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
lastValue
=
e
.
localY
;
s
.
lastValue
=
e
.
localY
;
}
}
else
{
else
{
...
@@ -11233,7 +11247,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
...
@@ -11233,7 +11247,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
s
.
isMouseDownState
=
2
;
s
.
isMouseDownState
=
2
;
var
currentValue
=
void
0
;
var
currentValue
=
void
0
;
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
exports
.
SCROLL_DIRECTION
.
VERTICAL
)
{
currentValue
=
e
.
localY
;
currentValue
=
e
.
localY
;
}
}
else
{
else
{
...
...
debug/engine.js.map
View file @
620d3045
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/2d/const.ts
View file @
620d3045
...
@@ -423,4 +423,7 @@ export const URL_FILE_EXTENSION: any = /\.(\w{3,4})(?:$|\?|#)/i;
...
@@ -423,4 +423,7 @@ export const URL_FILE_EXTENSION: any = /\.(\w{3,4})(?:$|\?|#)/i;
*/
*/
export
const
DATA_URI
:
any
=
/^
\s
*data:
(?:([\w
-
]
+
)\/([\w
+.-
]
+
))?(?:
;charset=
([\w
-
]
+
))?(?:
;
(
base64
))?
,
(
.*
)
/i
;
export
const
DATA_URI
:
any
=
/^
\s
*data:
(?:([\w
-
]
+
)\/([\w
+.-
]
+
))?(?:
;charset=
([\w
-
]
+
))?(?:
;
(
base64
))?
,
(
.*
)
/i
;
export
enum
SCROLL_DIRECTION
{
HORIZONTAL
=
'horizontal'
,
VERTICAL
=
'vertical'
,
}
src/2d/renderers/managers/StencilManager.ts
View file @
620d3045
...
@@ -87,9 +87,12 @@ export default class StencilManager {
...
@@ -87,9 +87,12 @@ export default class StencilManager {
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
graphics
.
renderable
=
true
;
graphics
.
renderable
=
true
;
var
tempAlpha
=
graphics
.
worldAlpha
;
//因为如果alpha为0,不会渲染,
graphics
.
worldAlpha
=
1
;
graphics
.
renderWebGL
(
this
.
renderer
);
graphics
.
renderWebGL
(
this
.
renderer
);
this
.
renderer
.
batchManager
.
flush
();
this
.
renderer
.
batchManager
.
flush
();
graphics
.
renderable
=
false
;
graphics
.
renderable
=
false
;
graphics
.
worldAlpha
=
tempAlpha
;
this
.
_useCurrent
();
this
.
_useCurrent
();
}
}
}
}
...
...
src/2d/text/TextField.ts
View file @
620d3045
...
@@ -229,7 +229,7 @@ export class TextField extends Sprite {
...
@@ -229,7 +229,7 @@ export class TextField extends Sprite {
return
this
.
_lineType
;
return
this
.
_lineType
;
}
}
private
_lineType
:
TEXT_lINETYPE
=
TEXT_lINETYPE
.
MULTI
;
private
_lineType
:
TEXT_lINETYPE
=
TEXT_lINETYPE
.
SINGLE
;
/**
/**
* 文本内容
* 文本内容
...
@@ -573,7 +573,7 @@ export class TextField extends Sprite {
...
@@ -573,7 +573,7 @@ export class TextField extends Sprite {
}
}
lineWidth
+=
charWidth
;
lineWidth
+=
charWidth
;
}
}
if
(
shouldMeasureTextWidth
)
{
if
(
shouldMeasureTextWidth
)
{
textWidth
=
Math
.
max
(
lineWidth
,
textWidth
);
textWidth
=
Math
.
max
(
lineWidth
,
textWidth
);
}
}
}
}
...
...
src/2d/ui/ScrollContainer.ts
View file @
620d3045
...
@@ -2,6 +2,7 @@ import Container from "../display/Container";
...
@@ -2,6 +2,7 @@ import Container from "../display/Container";
import
Graphics
from
"../graphics/Graphics"
;
import
Graphics
from
"../graphics/Graphics"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
import
{
Event
}
from
"../events/Event"
;
import
{
SCROLL_DIRECTION
}
from
"../const"
;
// import Tween from "../../tweenSimple/Tween";
// import Tween from "../../tweenSimple/Tween";
...
@@ -14,14 +15,14 @@ import {Event} from "../events/Event";
...
@@ -14,14 +15,14 @@ import {Event} from "../events/Event";
*/
*/
export
class
ScrollContainer
extends
Container
{
export
class
ScrollContainer
extends
Container
{
/**
/**
*
横向还是纵向 默认为纵
向
*
滚动方
向
* @property
isVertical
* @property
direction
* @type {
boolean
}
* @type {
SCROLL_DIRECTION
}
* @private
* @private
* @since 1.0.0
* @since 1.0.0
* @default true
* @default true
*/
*/
pr
otected
isVertical
:
boolean
=
true
;
pr
ivate
_direction
:
SCROLL_DIRECTION
;
/**
/**
* 可见区域的宽
* 可见区域的宽
* @property viewWidth
* @property viewWidth
...
@@ -148,10 +149,8 @@ export class ScrollContainer extends Container {
...
@@ -148,10 +149,8 @@ export class ScrollContainer extends Container {
/**
/**
* 构造函数
* 构造函数
* @method ScrollPage
* @method ScrollPage
* @param {number} vW 可视区域宽
* @param {number} vH 可视区域高
* @param {number} maxDistance 最大滚动的长度
* @param {number} maxDistance 最大滚动的长度
* @param
{boolean} isVertical 是纵向还是横向,也就是说是滚x还是滚y,默认值为沿y方向滚动
* @param
isFull
* @example
* @example
* var sPage=new ScrollPage(640,s.stage.viewRect.height,4943);
* var sPage=new ScrollPage(640,s.stage.viewRect.height,4943);
* sPage.isSpringBack = false;//是否回弹
* sPage.isSpringBack = false;//是否回弹
...
@@ -160,7 +159,7 @@ export class ScrollContainer extends Container {
...
@@ -160,7 +159,7 @@ export class ScrollContainer extends Container {
* sPage.y=stage.viewRect.y;
* sPage.y=stage.viewRect.y;
*
*
*/
*/
constructor
(
maxDistance
?:
number
,
is
Vertical
:
boolean
=
true
,
is
Full
=
false
)
{
constructor
(
maxDistance
?:
number
,
isFull
=
false
)
{
super
();
super
();
let
s
:
ScrollContainer
=
this
;
let
s
:
ScrollContainer
=
this
;
s
.
_instanceType
=
"ScrollContainer"
;
s
.
_instanceType
=
"ScrollContainer"
;
...
@@ -176,10 +175,11 @@ export class ScrollContainer extends Container {
...
@@ -176,10 +175,11 @@ export class ScrollContainer extends Container {
if
(
maxDistance
!==
undefined
)
{
if
(
maxDistance
!==
undefined
)
{
//s.maxDistance = maxDistance;
//s.maxDistance = maxDistance;
}
}
s
.
updateViewRect
(
isVertical
);
s
.
updateViewRect
();
s
.
direction
=
SCROLL_DIRECTION
.
VERTICAL
;
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
:
Event
)
{
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
:
Event
)
{
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
})
})
;
s
.
addEventListener
(
Event
.
REMOVED_FROM_STAGE
,
function
(
e
:
Event
)
{
s
.
addEventListener
(
Event
.
REMOVED_FROM_STAGE
,
function
(
e
:
Event
)
{
s
.
stage
.
removeEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
s
.
stage
.
removeEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
});
...
@@ -263,31 +263,35 @@ export class ScrollContainer extends Container {
...
@@ -263,31 +263,35 @@ export class ScrollContainer extends Container {
return
this
.
viewPort
.
height
;
return
this
.
viewPort
.
height
;
}
}
get
direction
():
SCROLL_DIRECTION
{
return
this
.
_direction
;
}
set
direction
(
value
:
SCROLL_DIRECTION
)
{
this
.
_direction
=
value
;
let
s
=
this
;
if
(
value
===
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
distance
=
s
.
height
;
s
.
paramXY
=
"y"
;
}
else
{
s
.
distance
=
s
.
width
;
s
.
paramXY
=
"x"
;
}
}
/**
/**
* 设置可见区域,可见区域的坐标始终在本地坐标中0,0点位置
* 设置可见区域,可见区域的坐标始终在本地坐标中0,0点位置
* @method setViewRect
* @method setViewRect
* @param {number}w 设置可见区域的宽
* @param {number}h 设置可见区域的高
* @param {boolean} isVertical 方向
* @public
* @public
* @since 1.1.1
* @since 1.1.1
*/
*/
public
updateViewRect
(
isVertical
?:
boolean
):
void
{
public
updateViewRect
():
void
{
let
s
:
ScrollContainer
=
this
;
let
s
:
ScrollContainer
=
this
;
s
.
maskObj
.
clear
();
s
.
maskObj
.
clear
();
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
s
.
maskObj
.
endFill
();
s
.
maskObj
.
endFill
();
if
(
isVertical
!==
undefined
)
{
s
.
isVertical
=
isVertical
;
}
if
(
isVertical
)
{
s
.
distance
=
s
.
height
;
s
.
paramXY
=
"y"
;
}
else
{
s
.
distance
=
s
.
width
;
s
.
paramXY
=
"x"
;
}
}
}
private
onMouseEvent
(
e
:
MouseEvent
):
void
{
private
onMouseEvent
(
e
:
MouseEvent
):
void
{
...
@@ -302,7 +306,7 @@ export class ScrollContainer extends Container {
...
@@ -302,7 +306,7 @@ export class ScrollContainer extends Container {
s
.
autoScroll
=
false
;
s
.
autoScroll
=
false
;
// Tween.kill(s._tweenId);
// Tween.kill(s._tweenId);
}
}
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
lastValue
=
e
.
localY
;
s
.
lastValue
=
e
.
localY
;
}
else
{
}
else
{
s
.
lastValue
=
e
.
localX
;
s
.
lastValue
=
e
.
localX
;
...
@@ -316,7 +320,7 @@ export class ScrollContainer extends Container {
...
@@ -316,7 +320,7 @@ export class ScrollContainer extends Container {
}
}
s
.
isMouseDownState
=
2
;
s
.
isMouseDownState
=
2
;
let
currentValue
:
number
;
let
currentValue
:
number
;
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
SCROLL_DIRECTION
.
VERTICAL
)
{
currentValue
=
e
.
localY
;
currentValue
=
e
.
localY
;
}
else
{
}
else
{
currentValue
=
e
.
localX
;
currentValue
=
e
.
localX
;
...
...
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