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
d364a706
Commit
d364a706
authored
Dec 04, 2019
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
eb2f29c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
28 deletions
+38
-28
RoundedRectangle.ts
src/2d/graphics/shapes/RoundedRectangle.ts
+8
-2
ScrollContainer.ts
src/2d/ui/ScrollContainer.ts
+30
-26
No files found.
src/2d/graphics/shapes/RoundedRectangle.ts
View file @
d364a706
import
{
SHAPES
}
from
'../../const'
;
import
{
Point
}
from
'../../math'
;
import
{
SHAPES
}
from
'../../const'
;
import
{
Point
}
from
'../../math'
;
/**
* The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its
...
...
@@ -40,6 +40,12 @@ export default class RoundedRectangle {
this
.
width
=
width
;
this
.
height
=
height
;
//计算最大圆角
let
max
=
(
width
<
height
?
width
:
height
)
/
2
;
//小于0取反
radius
=
radius
<
0
?
-
radius
:
radius
;
//大于max取max
radius
=
radius
>
max
?
max
:
radius
;
this
.
radius
=
radius
;
...
...
src/2d/ui/ScrollContainer.ts
View file @
d364a706
import
Container
from
"../display/Container"
;
import
Graphics
from
"../graphics/Graphics"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
import
{
MouseEvent
}
from
"../events/MouseEvent"
;
import
{
Event
}
from
"../events/Event"
;
// import Tween from "../../tweenSimple/Tween";
...
...
@@ -173,14 +173,20 @@ export class ScrollContainer extends Container {
s
.
maskObj
.
isUsedToMask
=
false
;
}
s
.
maskObj
.
alpha
=
0
;
if
(
maxDistance
!==
undefined
)
{
if
(
maxDistance
!==
undefined
)
{
//s.maxDistance = maxDistance;
}
s
.
updateViewRect
(
isVertical
);
// s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent.bind(s));
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
);
});
s
.
addEventListener
(
MouseEvent
.
MOUSE_DOWN
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_MOVE
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_UP
,
s
.
onMouseEvent
,
s
);
s
.
addEventListener
(
MouseEvent
.
MOUSE_OUT
,
s
.
onMouseEvent
,
s
);
//
s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
//
s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
s
.
addEventListener
(
Event
.
ENTER_FRAME
,
function
()
{
let
view
:
any
=
s
.
viewPort
;
if
(
s
.
autoScroll
)
return
;
...
...
@@ -253,7 +259,7 @@ export class ScrollContainer extends Container {
s
.
addEventListener
(
Event
.
RESIZE
,
this
.
updateViewRect
,
s
);
}
get
maxDistance
(){
get
maxDistance
()
{
return
this
.
viewPort
.
height
;
}
...
...
@@ -272,7 +278,7 @@ export class ScrollContainer extends Container {
s
.
maskObj
.
beginFill
(
"#000000"
);
s
.
maskObj
.
drawRect
(
0
,
0
,
s
.
width
,
s
.
height
);
s
.
maskObj
.
endFill
();
if
(
isVertical
!==
undefined
)
{
if
(
isVertical
!==
undefined
)
{
s
.
isVertical
=
isVertical
;
}
if
(
isVertical
)
{
...
...
@@ -288,8 +294,7 @@ export class ScrollContainer extends Container {
let
s
=
this
;
let
view
:
any
=
s
.
viewPort
;
// if (s.distance < s.maxDistance) {
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
if
(
s
.
isMouseDownState
<
1
)
{
if
(
e
.
type
==
MouseEvent
.
MOUSE_DOWN
)
{
if
(
!
s
.
isStop
)
{
s
.
isStop
=
true
;
}
...
...
@@ -304,9 +309,8 @@ export class ScrollContainer extends Container {
}
s
.
speed
=
0
;
s
.
isMouseDownState
=
1
;
return
;
}
;
else
if
(
e
.
type
==
MouseEvent
.
MOUSE_MOVE
)
{
if
(
s
.
isMouseDownState
==
1
)
{
s
.
dispatchEvent
(
Event
.
ON_SCROLL_START
);
}
...
...
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