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
Expand all
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:
})(
exports
.
GC_MODES
||
(
exports
.
GC_MODES
=
{}));
var
URL_FILE_EXTENSION
=
/
\.(\w{3,4})(?:
$|
\?
|#
)
/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
)
{
tslib_1
.
__extends
(
Matrix
,
_super
);
...
...
@@ -6742,9 +6746,12 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
gl
.
colorMask
(
false
,
false
,
false
,
false
);
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
graphics
.
renderable
=
true
;
var
tempAlpha
=
graphics
.
worldAlpha
;
graphics
.
worldAlpha
=
1
;
graphics
.
renderWebGL
(
this
.
renderer
);
this
.
renderer
.
batchManager
.
flush
();
graphics
.
renderable
=
false
;
graphics
.
worldAlpha
=
tempAlpha
;
this
.
_useCurrent
();
}
};
...
...
@@ -10324,7 +10331,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this
.
_textAlign
=
exports
.
TEXT_ALIGN
.
LEFT
;
_this
.
_verticalAlign
=
exports
.
VERTICAL_ALIGN
.
UP
;
_this
.
_lineSpacing
=
14
;
_this
.
_lineType
=
exports
.
TEXT_lINETYPE
.
MULTI
;
_this
.
_lineType
=
exports
.
TEXT_lINETYPE
.
SINGLE
;
_this
.
_text
=
""
;
_this
.
_font
=
"Arial"
;
_this
.
_size
=
12
;
...
...
@@ -11068,11 +11075,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var
ScrollContainer
=
(
function
(
_super
)
{
tslib_1
.
__extends
(
ScrollContainer
,
_super
);
function
ScrollContainer
(
maxDistance
,
isVertical
,
isFull
)
{
if
(
isVertical
===
void
0
)
{
isVertical
=
true
;
}
function
ScrollContainer
(
maxDistance
,
isFull
)
{
if
(
isFull
===
void
0
)
{
isFull
=
false
;
}
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
isVertical
=
true
;
_this
.
distance
=
0
;
_this
.
minDis
=
0
;
_this
.
maskObj
=
new
Graphics
();
...
...
@@ -11097,7 +11102,8 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s
.
maskObj
.
isUsedToMask
=
false
;
}
s
.
maskObj
.
alpha
=
0
;
s
.
updateViewRect
(
isVertical
);
s
.
updateViewRect
();
s
.
direction
=
exports
.
SCROLL_DIRECTION
.
VERTICAL
;
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
)
{
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
...
...
@@ -11188,23 +11194,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
enumerable
:
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
;
s
.
maskObj
.
clear
();
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
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
)
{
var
s
=
this
;
...
...
@@ -11216,7 +11230,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if
(
s
.
autoScroll
)
{
s
.
autoScroll
=
false
;
}
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
exports
.
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
lastValue
=
e
.
localY
;
}
else
{
...
...
@@ -11233,7 +11247,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
s
.
isMouseDownState
=
2
;
var
currentValue
=
void
0
;
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
exports
.
SCROLL_DIRECTION
.
VERTICAL
)
{
currentValue
=
e
.
localY
;
}
else
{
...
...
debug/engine.js.map
View file @
620d3045
This diff is collapsed.
Click to expand it.
src/2d/const.ts
View file @
620d3045
...
...
@@ -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
enum
SCROLL_DIRECTION
{
HORIZONTAL
=
'horizontal'
,
VERTICAL
=
'vertical'
,
}
src/2d/renderers/managers/StencilManager.ts
View file @
620d3045
...
...
@@ -87,9 +87,12 @@ export default class StencilManager {
gl
.
stencilOp
(
gl
.
KEEP
,
gl
.
KEEP
,
gl
.
DECR
);
graphics
.
renderable
=
true
;
var
tempAlpha
=
graphics
.
worldAlpha
;
//因为如果alpha为0,不会渲染,
graphics
.
worldAlpha
=
1
;
graphics
.
renderWebGL
(
this
.
renderer
);
this
.
renderer
.
batchManager
.
flush
();
graphics
.
renderable
=
false
;
graphics
.
worldAlpha
=
tempAlpha
;
this
.
_useCurrent
();
}
}
...
...
src/2d/text/TextField.ts
View file @
620d3045
...
...
@@ -229,7 +229,7 @@ export class TextField extends Sprite {
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 {
}
lineWidth
+=
charWidth
;
}
if
(
shouldMeasureTextWidth
)
{
if
(
shouldMeasureTextWidth
)
{
textWidth
=
Math
.
max
(
lineWidth
,
textWidth
);
}
}
...
...
src/2d/ui/ScrollContainer.ts
View file @
620d3045
...
...
@@ -2,6 +2,7 @@ import Container from "../display/Container";
import
Graphics
from
"../graphics/Graphics"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
import
{
SCROLL_DIRECTION
}
from
"../const"
;
// import Tween from "../../tweenSimple/Tween";
...
...
@@ -14,14 +15,14 @@ import {Event} from "../events/Event";
*/
export
class
ScrollContainer
extends
Container
{
/**
*
横向还是纵向 默认为纵
向
* @property
isVertical
* @type {
boolean
}
*
滚动方
向
* @property
direction
* @type {
SCROLL_DIRECTION
}
* @private
* @since 1.0.0
* @default true
*/
pr
otected
isVertical
:
boolean
=
true
;
pr
ivate
_direction
:
SCROLL_DIRECTION
;
/**
* 可见区域的宽
* @property viewWidth
...
...
@@ -148,10 +149,8 @@ export class ScrollContainer extends Container {
/**
* 构造函数
* @method ScrollPage
* @param {number} vW 可视区域宽
* @param {number} vH 可视区域高
* @param {number} maxDistance 最大滚动的长度
* @param
{boolean} isVertical 是纵向还是横向,也就是说是滚x还是滚y,默认值为沿y方向滚动
* @param
isFull
* @example
* var sPage=new ScrollPage(640,s.stage.viewRect.height,4943);
* sPage.isSpringBack = false;//是否回弹
...
...
@@ -160,7 +159,7 @@ export class ScrollContainer extends Container {
* sPage.y=stage.viewRect.y;
*
*/
constructor
(
maxDistance
?:
number
,
is
Vertical
:
boolean
=
true
,
is
Full
=
false
)
{
constructor
(
maxDistance
?:
number
,
isFull
=
false
)
{
super
();
let
s
:
ScrollContainer
=
this
;
s
.
_instanceType
=
"ScrollContainer"
;
...
...
@@ -176,10 +175,11 @@ export class ScrollContainer extends Container {
if
(
maxDistance
!==
undefined
)
{
//s.maxDistance = maxDistance;
}
s
.
updateViewRect
(
isVertical
);
s
.
updateViewRect
();
s
.
direction
=
SCROLL_DIRECTION
.
VERTICAL
;
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
:
Event
)
{
s
.
stage
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
})
})
;
s
.
addEventListener
(
Event
.
REMOVED_FROM_STAGE
,
function
(
e
:
Event
)
{
s
.
stage
.
removeEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
});
...
...
@@ -263,31 +263,35 @@ export class ScrollContainer extends Container {
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点位置
* @method setViewRect
* @param {number}w 设置可见区域的宽
* @param {number}h 设置可见区域的高
* @param {boolean} isVertical 方向
* @public
* @since 1.1.1
*/
public
updateViewRect
(
isVertical
?:
boolean
):
void
{
public
updateViewRect
():
void
{
let
s
:
ScrollContainer
=
this
;
s
.
maskObj
.
clear
();
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
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
{
...
...
@@ -302,7 +306,7 @@ export class ScrollContainer extends Container {
s
.
autoScroll
=
false
;
// Tween.kill(s._tweenId);
}
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
SCROLL_DIRECTION
.
VERTICAL
)
{
s
.
lastValue
=
e
.
localY
;
}
else
{
s
.
lastValue
=
e
.
localX
;
...
...
@@ -316,7 +320,7 @@ export class ScrollContainer extends Container {
}
s
.
isMouseDownState
=
2
;
let
currentValue
:
number
;
if
(
s
.
isVertical
)
{
if
(
s
.
_direction
===
SCROLL_DIRECTION
.
VERTICAL
)
{
currentValue
=
e
.
localY
;
}
else
{
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