@next2d/ui 1.18.7 → 1.18.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Job.d.ts +7 -7
- package/dist/Job.js +41 -40
- package/package.json +3 -3
package/dist/Job.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventDispatcher
|
|
1
|
+
import { EventDispatcher } from "@next2d/events";
|
|
2
2
|
/**
|
|
3
3
|
* @class
|
|
4
4
|
* @memberOf next2d.ui
|
|
@@ -16,6 +16,7 @@ export declare class Job extends EventDispatcher {
|
|
|
16
16
|
private _$forceStop;
|
|
17
17
|
private _$to;
|
|
18
18
|
private _$currentTime;
|
|
19
|
+
private _$timerId;
|
|
19
20
|
/**
|
|
20
21
|
* @param {object} target
|
|
21
22
|
* @param {object} [from=null]
|
|
@@ -119,15 +120,15 @@ export declare class Job extends EventDispatcher {
|
|
|
119
120
|
* @param {object} object
|
|
120
121
|
* @return {array}
|
|
121
122
|
* @method
|
|
122
|
-
* @
|
|
123
|
+
* @private
|
|
123
124
|
*/
|
|
124
|
-
entries(object: any): any[];
|
|
125
|
+
_$entries(object: any): any[];
|
|
125
126
|
/**
|
|
126
|
-
* @return {
|
|
127
|
+
* @return {void}
|
|
127
128
|
* @method
|
|
128
129
|
* @public
|
|
129
130
|
*/
|
|
130
|
-
start():
|
|
131
|
+
start(): void;
|
|
131
132
|
/**
|
|
132
133
|
* @return {void}
|
|
133
134
|
* @method
|
|
@@ -135,12 +136,11 @@ export declare class Job extends EventDispatcher {
|
|
|
135
136
|
*/
|
|
136
137
|
stop(): void;
|
|
137
138
|
/**
|
|
138
|
-
* @param {Event} event
|
|
139
139
|
* @return {void}
|
|
140
140
|
* @method
|
|
141
141
|
* @private
|
|
142
142
|
*/
|
|
143
|
-
_$update(
|
|
143
|
+
_$update(): void;
|
|
144
144
|
/**
|
|
145
145
|
* @param {object} target
|
|
146
146
|
* @param {object} from
|
package/dist/Job.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Easing } from "./Easing";
|
|
2
2
|
import { EventDispatcher, Event } from "@next2d/events";
|
|
3
|
-
import { $setTimeout, $performance } from "@next2d/share";
|
|
3
|
+
import { $setTimeout, $performance, $cancelAnimationFrame } from "@next2d/share";
|
|
4
4
|
/**
|
|
5
5
|
* @class
|
|
6
6
|
* @memberOf next2d.ui
|
|
@@ -85,6 +85,12 @@ export class Job extends EventDispatcher {
|
|
|
85
85
|
* @private
|
|
86
86
|
*/
|
|
87
87
|
this._$currentTime = 0;
|
|
88
|
+
/**
|
|
89
|
+
* @type {number}
|
|
90
|
+
* @default 0
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
this._$timerId = 0;
|
|
88
94
|
}
|
|
89
95
|
/**
|
|
90
96
|
* @description 指定されたクラスのストリングを返します。
|
|
@@ -211,50 +217,44 @@ export class Job extends EventDispatcher {
|
|
|
211
217
|
// setup
|
|
212
218
|
this._$stopFlag = false;
|
|
213
219
|
this._$startTime = $performance.now();
|
|
214
|
-
this._$names = this.entries(this._$from);
|
|
215
|
-
//
|
|
216
|
-
this.
|
|
217
|
-
this._$update(event);
|
|
218
|
-
});
|
|
220
|
+
this._$names = this._$entries(this._$from);
|
|
221
|
+
// start
|
|
222
|
+
this._$update();
|
|
219
223
|
}
|
|
220
224
|
/**
|
|
221
225
|
* @param {object} object
|
|
222
226
|
* @return {array}
|
|
223
227
|
* @method
|
|
224
|
-
* @
|
|
228
|
+
* @private
|
|
225
229
|
*/
|
|
226
|
-
entries(object) {
|
|
230
|
+
_$entries(object) {
|
|
227
231
|
const entries = Object.entries(object);
|
|
228
232
|
for (let idx = 0; idx < entries.length; ++idx) {
|
|
229
233
|
const values = entries[idx];
|
|
230
234
|
const value = values[1];
|
|
231
235
|
if (value && typeof value === "object") {
|
|
232
|
-
values[1] = this.entries(value);
|
|
236
|
+
values[1] = this._$entries(value);
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
return entries;
|
|
236
240
|
}
|
|
237
241
|
/**
|
|
238
|
-
* @return {
|
|
242
|
+
* @return {void}
|
|
239
243
|
* @method
|
|
240
244
|
* @public
|
|
241
245
|
*/
|
|
242
246
|
start() {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
this.initialize();
|
|
257
|
-
});
|
|
247
|
+
if (this._$timerId) {
|
|
248
|
+
$cancelAnimationFrame(this._$timerId);
|
|
249
|
+
}
|
|
250
|
+
this._$forceStop = false;
|
|
251
|
+
if (this._$delay) {
|
|
252
|
+
$setTimeout(() => {
|
|
253
|
+
this.initialize();
|
|
254
|
+
}, this._$delay * 1000);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
this.initialize();
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
260
|
* @return {void}
|
|
@@ -262,44 +262,45 @@ export class Job extends EventDispatcher {
|
|
|
262
262
|
* @public
|
|
263
263
|
*/
|
|
264
264
|
stop() {
|
|
265
|
+
if (this._$timerId) {
|
|
266
|
+
$cancelAnimationFrame(this._$timerId);
|
|
267
|
+
}
|
|
265
268
|
if (this.hasEventListener(Event.STOP)) {
|
|
266
269
|
this.dispatchEvent(new Event(Event.STOP));
|
|
270
|
+
this.removeAllEventListener(Event.STOP);
|
|
267
271
|
}
|
|
268
|
-
|
|
269
|
-
this.removeAllEventListener(Event.ENTER_FRAME);
|
|
270
|
-
}
|
|
271
|
-
if (this.hasEventListener(Event.UPDATE)) {
|
|
272
|
-
this.removeAllEventListener(Event.UPDATE);
|
|
273
|
-
}
|
|
274
|
-
if (this.hasEventListener(Event.COMPLETE)) {
|
|
275
|
-
this.removeAllEventListener(Event.COMPLETE);
|
|
276
|
-
}
|
|
272
|
+
this._$names = null;
|
|
277
273
|
this._$forceStop = true;
|
|
278
274
|
this._$stopFlag = true;
|
|
279
275
|
}
|
|
280
276
|
/**
|
|
281
|
-
* @param {Event} event
|
|
282
277
|
* @return {void}
|
|
283
278
|
* @method
|
|
284
279
|
* @private
|
|
285
280
|
*/
|
|
286
|
-
_$update(
|
|
281
|
+
_$update() {
|
|
287
282
|
if (this._$stopFlag) {
|
|
288
283
|
return;
|
|
289
284
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this._$updateProperty(this._$target, this._$from, this._$to, this._$names);
|
|
285
|
+
if (!this._$names) {
|
|
286
|
+
return this.stop();
|
|
293
287
|
}
|
|
288
|
+
// update current time
|
|
289
|
+
this._$currentTime = ($performance.now() - this._$startTime) * 0.001;
|
|
290
|
+
this._$updateProperty(this._$target, this._$from, this._$to, this._$names);
|
|
294
291
|
if (this.hasEventListener(Event.UPDATE)) {
|
|
295
292
|
this.dispatchEvent(new Event(Event.UPDATE));
|
|
296
293
|
}
|
|
297
294
|
if (this._$currentTime >= this._$duration) {
|
|
298
|
-
this.removeEventListener(Event.ENTER_FRAME, event.listener);
|
|
299
295
|
if (this.hasEventListener(Event.COMPLETE)) {
|
|
300
296
|
this.dispatchEvent(new Event(Event.COMPLETE));
|
|
301
297
|
}
|
|
302
298
|
}
|
|
299
|
+
else {
|
|
300
|
+
this._$timerId = requestAnimationFrame(() => {
|
|
301
|
+
this._$update();
|
|
302
|
+
});
|
|
303
|
+
}
|
|
303
304
|
}
|
|
304
305
|
/**
|
|
305
306
|
* @param {object} target
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/ui",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.9",
|
|
4
4
|
"description": "Next2D UI Packages",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@tvon.jp> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@next2d/events": "1.18.
|
|
36
|
-
"@next2d/share": "1.18.
|
|
35
|
+
"@next2d/events": "1.18.9",
|
|
36
|
+
"@next2d/share": "1.18.9"
|
|
37
37
|
}
|
|
38
38
|
}
|