Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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
劳工
zeroing-libs
Commits
7de6de9a
Commit
7de6de9a
authored
Aug 17, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
b4f2e18e
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
23 deletions
+162
-23
rockji.json
dist/customs/rockji.json
+124
-0
show-toast.json
dist/processes/view/show-toast.json
+1
-1
zoom-scroll.json
dist/scripts/zoom-scroll.json
+6
-1
index.ts
src/process/view/show-toast/index.ts
+4
-2
index.ts
src/script/zoom-scroll/index.ts
+21
-18
meta.json
src/script/zoom-scroll/meta.json
+6
-1
No files found.
dist/customs/rockji.json
0 → 100644
View file @
7de6de9a
This diff is collapsed.
Click to expand it.
dist/processes/view/show-toast.json
View file @
7de6de9a
...
...
@@ -47,7 +47,7 @@
"success"
],
"id"
:
"show-toast"
,
"script"
:
"var toastProps =
Object.assign({}, p
rops, args);
\n
global.gameStage.toast.show(toastProps);
\n
next('success');
\n
"
,
"script"
:
"var toastProps =
{};
\n
engine.injectProp(toastProps, props);
\n
engine.injectProp(toastP
rops, args);
\n
global.gameStage.toast.show(toastProps);
\n
next('success');
\n
"
,
"group"
:
"view"
,
"type"
:
"builtin"
}
dist/scripts/zoom-scroll.json
View file @
7de6de9a
This diff is collapsed.
Click to expand it.
src/process/view/show-toast/index.ts
View file @
7de6de9a
...
...
@@ -2,7 +2,9 @@
* Created by rockyl on 2019-11-16.
*/
const
toastProps
=
Object
.
assign
({},
props
,
args
);
const
toastProps
=
{};
engine
.
injectProp
(
toastProps
,
props
);
engine
.
injectProp
(
toastProps
,
args
);
global
.
gameStage
.
toast
.
show
(
toastProps
);
...
...
src/script/zoom-scroll/index.ts
View file @
7de6de9a
...
...
@@ -7,6 +7,7 @@ export default class ZoomScroll extends engine.ScriptBase {
autoInit
:
boolean
=
true
;
duration
:
number
=
1000
;
mvvmMode
:
boolean
=
false
;
@
engine
.
dirtyFieldTrigger
index
:
number
=
0
;
@
engine
.
dirtyFieldTrigger
...
...
@@ -31,36 +32,32 @@ export default class ZoomScroll extends engine.ScriptBase {
this
.
_centerOffset
=
this
.
host
.
width
/
2
;
if
(
this
.
autoInit
){
this
.
init
(
);
setTimeout
(
this
.
init
);
}
}
sleep
():
void
{
this
.
host
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDragStart
,
this
);
}
update
(
t
)
{
get
children
()
{
return
this
.
mvvmMode
?
this
.
host
.
children
[
0
].
children
:
this
.
host
.
children
;
}
init
()
{
for
(
let
i
=
0
,
li
=
this
.
host
.
children
.
length
;
i
<
li
;
i
++
)
{
const
child
=
this
.
host
.
children
[
i
];
init
=
()
=>
{
for
(
let
i
=
0
,
li
=
this
.
children
.
length
;
i
<
li
;
i
++
)
{
const
child
=
this
.
children
[
i
];
child
.
anchorX
=
child
.
width
/
2
;
child
.
anchorY
=
child
.
height
/
2
;
child
.
x
=
child
.
ix
=
i
*
this
.
itemWidth
+
this
.
_centerOffset
-
this
.
itemWidth
/
2
;
}
this
.
scrollTo
(
0
,
false
);
this
.
host
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onDragStart
,
this
);
}
updateOffset
(
offset
)
{
this
.
_dragOffset
.
x
=
this
.
_startDragOffset
.
x
+
offset
.
x
;
for
(
let
i
=
0
,
li
=
this
.
host
.
children
.
length
;
i
<
li
;
i
++
)
{
const
child
=
this
.
host
.
children
[
i
];
for
(
let
i
=
0
,
li
=
this
.
children
.
length
;
i
<
li
;
i
++
)
{
const
child
=
this
.
children
[
i
];
let
x
=
child
.
x
=
child
.
ix
+
this
.
_dragOffset
.
x
;
let
s
=
40
/
Math
.
abs
(
x
-
this
.
_centerOffset
+
this
.
itemWidth
/
2
);
...
...
@@ -109,9 +106,7 @@ export default class ZoomScroll extends engine.ScriptBase {
this
.
_startDragOffset
.
y
=
0
;
let
index
=
Math
.
round
(
this
.
_dragOffset
.
x
/
this
.
itemWidth
);
index
=
-
Math
.
min
(
0
,
Math
.
max
(
1
-
this
.
host
.
children
.
length
,
index
));
this
[
'_index'
]
=
index
;
index
=
-
Math
.
min
(
0
,
Math
.
max
(
1
-
this
.
children
.
length
,
index
));
this
.
scrollTo
(
index
);
...
...
@@ -127,12 +122,20 @@ export default class ZoomScroll extends engine.ScriptBase {
}
private
scrollTo
(
index
,
animation
=
true
)
{
this
[
'_index'
]
=
index
;
this
.
host
.
dispatchEvent
(
'willScroll'
,
{
index
});
let
indexPos
=
-
index
*
this
.
itemWidth
;
if
(
animation
)
{
engine
.
Tween
.
get
(
this
,
null
,
null
,
true
)
.
to
({
t
:
indexPos
},
100
,
engine
.
Ease
.
cubicOut
);
.
to
({
t
:
indexPos
},
100
,
engine
.
Ease
.
cubicOut
)
.
call
(()
=>
{
this
.
host
.
dispatchEvent
(
'didScrolled'
,
{
index
});
});
}
else
{
this
.
t
=
indexPos
;
this
.
host
.
dispatchEvent
(
'didScrolled'
,
{
index
});
}
}
...
...
@@ -141,7 +144,7 @@ export default class ZoomScroll extends engine.ScriptBase {
case
'index'
:
let
index
=
value
;
if
(
oldValue
!==
undefined
){
index
=
Math
.
max
(
0
,
Math
.
min
(
this
.
host
.
children
.
length
-
1
,
value
));
index
=
Math
.
max
(
0
,
Math
.
min
(
this
.
children
.
length
-
1
,
value
));
this
[
'_index'
]
=
index
;
}
...
...
src/script/zoom-scroll/meta.json
View file @
7de6de9a
{
"name"
:
"缩放滚动"
,
"props"
:
{
"mvvmMode"
:
{
"alias"
:
"mvvm模式"
,
"type"
:
"boolean"
,
"default"
:
false
},
"autoInit"
:
{
"alias"
:
"自动初始化"
,
"type"
:
"boolean"
,
...
...
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