@m2c2kit/core 0.3.6 → 0.3.7
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/assets/canvaskit.wasm +0 -0
- package/dist/index.d.ts +593 -537
- package/dist/index.js +670 -603
- package/package.json +11 -12
- package/post-install.mjs +0 -98
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Image, CanvasKit,
|
|
1
|
+
import { Image, CanvasKit, Canvas, Surface, FontMgr, Typeface, EmbindObject, Font, Paint, ParagraphBuilder, Paragraph, Path, PaintStyle } from 'canvaskit-wasm';
|
|
2
2
|
|
|
3
3
|
declare class GlobalVariables {
|
|
4
4
|
now: number;
|
|
@@ -78,6 +78,7 @@ interface JsonSchema {
|
|
|
78
78
|
default?: any;
|
|
79
79
|
}
|
|
80
80
|
type JsonSchemaDataType = "string" | "number" | "integer" | "object" | "array" | "boolean" | "null";
|
|
81
|
+
type JsonSchemaDataTypeScriptTypes = string | number | object | boolean | null | undefined | Array<string> | Array<number> | Array<object> | Array<boolean> | Array<null>;
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* All the data created by an activity.
|
|
@@ -100,7 +101,7 @@ interface ActivityResults {
|
|
|
100
101
|
*
|
|
101
102
|
* @remarks Event contains all the data created by an activity, with
|
|
102
103
|
* separate properties for the newly created data. ActivityResultsEvent
|
|
103
|
-
*
|
|
104
|
+
* inherits "data" from ActivityResults, which contains the complete data
|
|
104
105
|
* up to this point (both new and existing data).
|
|
105
106
|
*/
|
|
106
107
|
interface ActivityResultsEvent extends ActivityEvent, ActivityResults {
|
|
@@ -108,7 +109,7 @@ interface ActivityResultsEvent extends ActivityEvent, ActivityResults {
|
|
|
108
109
|
newData: ActivityKeyValueData;
|
|
109
110
|
/** JSON schema describing the new data */
|
|
110
111
|
newDataSchema: JsonSchema;
|
|
111
|
-
/** ISO 8601 timestamp of the event. Specifically, value of "new Date().toISOString()" executed on the device when the ActivityResultsEvent
|
|
112
|
+
/** ISO 8601 timestamp of the event. Specifically, value of "new Date().toISOString()" executed on the device when the ActivityResultsEvent occurred. */
|
|
112
113
|
iso8601Timestamp: string;
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -194,6 +195,8 @@ declare class ImageManager {
|
|
|
194
195
|
private _scratchCanvas?;
|
|
195
196
|
private ctx?;
|
|
196
197
|
private scale?;
|
|
198
|
+
private session;
|
|
199
|
+
constructor(session: Session);
|
|
197
200
|
/**
|
|
198
201
|
* Returns a CanvasKit Image that was previously rendered by the ImageManager.
|
|
199
202
|
*
|
|
@@ -267,367 +270,91 @@ declare class ImageManager {
|
|
|
267
270
|
removeScratchCanvas(): void;
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
interface
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* Fonts have been converted to canvaskit Typeface
|
|
278
|
-
*/
|
|
279
|
-
declare class GameTypefaces {
|
|
280
|
-
[gameUuid: string]: {
|
|
281
|
-
[fontFamily: string]: Typeface;
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Class for loading, preparing, and providing fonts to games.
|
|
286
|
-
*
|
|
287
|
-
* @remarks FOR INTERNAL USE ONLY
|
|
288
|
-
*/
|
|
289
|
-
declare class FontManager {
|
|
290
|
-
canvasKit?: CanvasKit;
|
|
291
|
-
fontMgr?: FontMgr;
|
|
292
|
-
gameTypefaces: GameTypefaces;
|
|
293
|
-
private allGamesFontData?;
|
|
294
|
-
/**
|
|
295
|
-
* Gets a typeface that was previously loaded for the specified game.
|
|
296
|
-
*
|
|
297
|
-
* @param gameUuid
|
|
298
|
-
* @param fontFamily
|
|
299
|
-
* @returns the requested Typeface
|
|
300
|
-
*/
|
|
301
|
-
getTypeface(gameUuid: string, fontFamily: string): Typeface;
|
|
302
|
-
/**
|
|
303
|
-
* Gets names of fonts loaded for the specified game.
|
|
304
|
-
*
|
|
305
|
-
* @param gameUuid
|
|
306
|
-
* @returns array of font family names
|
|
307
|
-
*/
|
|
308
|
-
getFontNames(gameUuid: string): Array<string>;
|
|
309
|
-
/**
|
|
310
|
-
* Fetches all fonts for all games.
|
|
311
|
-
*
|
|
312
|
-
* @param allGamesFontUrls
|
|
313
|
-
* @returns
|
|
314
|
-
*/
|
|
315
|
-
fetchFonts(allGamesFontUrls: Array<GameFontUrls>): Promise<void>;
|
|
316
|
-
/**
|
|
317
|
-
* Takes the fonts, which have been previously fetched and converted into
|
|
318
|
-
* Array Buffers using FontManager.fetchFonts(), and makes them available
|
|
319
|
-
* to our engine
|
|
320
|
-
*/
|
|
321
|
-
loadAllGamesFontData(): void;
|
|
322
|
-
/**
|
|
323
|
-
* For the specified game, fetches all fonts in the array of urls and
|
|
324
|
-
* stores fonts as array buffers.
|
|
325
|
-
*
|
|
326
|
-
* @param gameUuid
|
|
327
|
-
* @param fontUrls - array of font urls
|
|
328
|
-
* @returns
|
|
329
|
-
*/
|
|
330
|
-
private fetchGameFontsAsArrayBuffers;
|
|
331
|
-
/**
|
|
332
|
-
* For the specified game, loads all fonts from array buffers and makes
|
|
333
|
-
* fonts available within canvaskit as a Typeface
|
|
334
|
-
*
|
|
335
|
-
* @param gameUuid
|
|
336
|
-
* @param fonts - array of fonts in array buffer form
|
|
337
|
-
*/
|
|
338
|
-
private loadGameFonts;
|
|
273
|
+
interface FontData {
|
|
274
|
+
gameUuid: string;
|
|
275
|
+
fontUrl: string;
|
|
276
|
+
fontName: string;
|
|
277
|
+
fontFamilyName: string;
|
|
278
|
+
fontArrayBuffer: ArrayBuffer;
|
|
279
|
+
isDefault: boolean;
|
|
339
280
|
}
|
|
340
281
|
|
|
282
|
+
type EasingFunction = (
|
|
283
|
+
/** elapsed time since start of action */
|
|
284
|
+
t: number,
|
|
285
|
+
/** start value of value to be eased */
|
|
286
|
+
b: number,
|
|
287
|
+
/** total change of value to be eased */
|
|
288
|
+
c: number,
|
|
289
|
+
/** total duration of action */
|
|
290
|
+
d: number) => number;
|
|
341
291
|
/**
|
|
342
|
-
*
|
|
343
|
-
* creates data.
|
|
292
|
+
* The Easings class has static methods for creating easings to be used in actions.
|
|
344
293
|
*/
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
294
|
+
declare class Easings {
|
|
295
|
+
static none: EasingFunction;
|
|
296
|
+
static linear: EasingFunction;
|
|
297
|
+
static quadraticIn: EasingFunction;
|
|
298
|
+
static quadraticOut: EasingFunction;
|
|
299
|
+
static quadraticInOut: EasingFunction;
|
|
300
|
+
static cubicIn: EasingFunction;
|
|
301
|
+
static cubicOut: EasingFunction;
|
|
302
|
+
static cubicInOut: EasingFunction;
|
|
303
|
+
static quarticIn: EasingFunction;
|
|
304
|
+
static quarticOut: EasingFunction;
|
|
305
|
+
static quarticInOut: EasingFunction;
|
|
306
|
+
static quinticIn: EasingFunction;
|
|
307
|
+
static quinticOut: EasingFunction;
|
|
308
|
+
static quinticInOut: EasingFunction;
|
|
309
|
+
static sinusoidalIn: EasingFunction;
|
|
310
|
+
static sinusoidalOut: EasingFunction;
|
|
311
|
+
static sinusoidalInOut: EasingFunction;
|
|
312
|
+
static exponentialIn: EasingFunction;
|
|
313
|
+
static exponentialOut: EasingFunction;
|
|
314
|
+
static exponentialInOut: EasingFunction;
|
|
315
|
+
static circularIn: EasingFunction;
|
|
316
|
+
static circularOut: EasingFunction;
|
|
317
|
+
static circularInOut: EasingFunction;
|
|
359
318
|
}
|
|
360
319
|
|
|
361
320
|
/**
|
|
362
|
-
*
|
|
321
|
+
* Position in two-dimensional space.
|
|
363
322
|
*/
|
|
364
|
-
interface
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
onSessionLifecycle?: (event: SessionLifecycleEvent) => void;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
interface SessionOptions {
|
|
373
|
-
/** The activities that compose this session */
|
|
374
|
-
activities: Array<Activity>;
|
|
375
|
-
/** Callbacks executed when activity events occurs, such as when activity creates data or ends */
|
|
376
|
-
activityCallbacks?: ActivityCallbacks;
|
|
377
|
-
/** Callbacks executed when session events occur */
|
|
378
|
-
sessionCallbacks?: SessionCallbacks;
|
|
379
|
-
/** Url of the canvaskit.wasm binary. Always set to the default value of "assets/canvaskit.wasm" */
|
|
380
|
-
canvasKitWasmUrl: "assets/canvaskit.wasm";
|
|
381
|
-
/** Use a specified session UUID, rather than create a new one */
|
|
382
|
-
sessionUuid?: string;
|
|
383
|
-
/** NOT IMPLEMENTED YET: Orientation the screen should be locked to for this session. Value will be passed into the ScreenOrientation.lock() Web API. */
|
|
384
|
-
orientation?: "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
|
|
323
|
+
interface Point {
|
|
324
|
+
/** Horizontal coordinate */
|
|
325
|
+
x: number;
|
|
326
|
+
/** Vertical coordinate */
|
|
327
|
+
y: number;
|
|
385
328
|
}
|
|
386
329
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
imageManager: ImageManager;
|
|
391
|
-
currentActivity?: Activity;
|
|
392
|
-
uuid: string;
|
|
393
|
-
dataStore?: IDataStore;
|
|
394
|
-
private sessionDictionary;
|
|
395
|
-
private canvasKit?;
|
|
396
|
-
private version;
|
|
397
|
-
/**
|
|
398
|
-
* A Session contains one or more activities. The session manages the start
|
|
399
|
-
* and stop of activities, and advancement to next activity
|
|
400
|
-
*
|
|
401
|
-
* @param options
|
|
402
|
-
*/
|
|
403
|
-
constructor(options: SessionOptions);
|
|
404
|
-
/**
|
|
405
|
-
* Asynchronously initializes the m2c2kit engine and loads assets
|
|
406
|
-
*/
|
|
407
|
-
init(): Promise<void>;
|
|
408
|
-
/**
|
|
409
|
-
* Starts the session and starts the first activity.
|
|
410
|
-
*/
|
|
411
|
-
start(): Promise<void>;
|
|
412
|
-
/**
|
|
413
|
-
* Declares the session ended and sends callback.
|
|
414
|
-
*/
|
|
415
|
-
end(): void;
|
|
416
|
-
private stop;
|
|
330
|
+
interface IDrawable {
|
|
331
|
+
draw(canvas: Canvas): void;
|
|
332
|
+
warmup(canvas: Canvas): void;
|
|
417
333
|
/**
|
|
418
|
-
* Frees up resources that were allocated
|
|
334
|
+
* Frees up resources that were allocated for this drawable entity.
|
|
419
335
|
*
|
|
420
336
|
* @remarks This will be done automatically by the m2c2kit library;
|
|
421
337
|
* the end-user must not call this.
|
|
422
338
|
*/
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
*
|
|
427
|
-
* @param options
|
|
428
|
-
*/
|
|
429
|
-
goToActivity(options: GoToActivityOptions): Promise<void>;
|
|
430
|
-
/**
|
|
431
|
-
* Stops the current activity and advances to next activity in the session.
|
|
432
|
-
* If there is no activity after the current activity, throws error.
|
|
433
|
-
*/
|
|
434
|
-
goToNextActivity(): Promise<void>;
|
|
435
|
-
/**
|
|
436
|
-
* Stops the current activity and advances to next activity in the session.
|
|
437
|
-
* If there is no activity after the current activity, throws error.
|
|
438
|
-
*
|
|
439
|
-
* @deprecated Use goToNextActivity() instead.
|
|
440
|
-
*/
|
|
441
|
-
advanceToNextActivity(): Promise<void>;
|
|
442
|
-
/**
|
|
443
|
-
* Gets the next activity after the current one, or undefined if
|
|
444
|
-
* this is the last activity.
|
|
445
|
-
*/
|
|
446
|
-
get nextActivity(): Activity | undefined;
|
|
447
|
-
/**
|
|
448
|
-
* Saves an item to the session's key-value dictionary.
|
|
449
|
-
*
|
|
450
|
-
* @remarks The session dictionary is not persisted. It is available only
|
|
451
|
-
* during the actively running session. It is useful for storing temporary
|
|
452
|
-
* data to coordinate between activities.
|
|
453
|
-
*
|
|
454
|
-
* @param key - item key
|
|
455
|
-
* @param value - item value
|
|
456
|
-
*/
|
|
457
|
-
dictionarySetItem(key: string, value: SessionDictionaryValues): void;
|
|
458
|
-
/**
|
|
459
|
-
* Gets an item value from the session's key-value dictionary.
|
|
460
|
-
*
|
|
461
|
-
* @remarks The session dictionary is not persisted. It is available only
|
|
462
|
-
* during the actively running session. It is useful for storing temporary
|
|
463
|
-
* data to coordinate between activities.
|
|
464
|
-
*
|
|
465
|
-
* @param key - item key
|
|
466
|
-
* @returns value of the item
|
|
467
|
-
*/
|
|
468
|
-
dictionaryGetItem<T extends SessionDictionaryValues>(key: string): T;
|
|
469
|
-
/**
|
|
470
|
-
* Deletes an item value from the session's key-value dictionary.
|
|
471
|
-
*
|
|
472
|
-
* @remarks The session dictionary is not persisted. It is available only
|
|
473
|
-
* during the actively running session. It is useful for storing temporary
|
|
474
|
-
* data to coordinate between activities.
|
|
475
|
-
*
|
|
476
|
-
* @param key - item key
|
|
477
|
-
* @returns true if the item was deleted, false if it did not exist
|
|
478
|
-
*/
|
|
479
|
-
dictionaryDeleteItem(key: string): boolean;
|
|
480
|
-
/**
|
|
481
|
-
* Determines if a key exists in the activity's key-value dictionary.
|
|
482
|
-
*
|
|
483
|
-
* @remarks The session dictionary is not persisted. It is available only
|
|
484
|
-
* during the actively running session. It is useful for storing temporary
|
|
485
|
-
* data to coordinate between activities.
|
|
486
|
-
*
|
|
487
|
-
* @param key - item key
|
|
488
|
-
* @returns true if the key exists, false otherwise
|
|
489
|
-
*/
|
|
490
|
-
dictionaryItemExists(key: string): boolean;
|
|
491
|
-
/**
|
|
492
|
-
* Gets asynchronous assets, including initialization of canvaskit wasm,
|
|
493
|
-
* fetching of fonts from specified urls, and rendering and fetching
|
|
494
|
-
* of images
|
|
495
|
-
* @returns
|
|
496
|
-
*/
|
|
497
|
-
private getAsynchronousAssets;
|
|
498
|
-
private loadCanvasKit;
|
|
499
|
-
private loadAssets;
|
|
500
|
-
private assignCanvasKit;
|
|
501
|
-
private getFontsConfigurationFromGames;
|
|
502
|
-
private getImagesConfigurationFromGames;
|
|
503
|
-
}
|
|
504
|
-
interface GoToActivityOptions {
|
|
505
|
-
/** ActivityId of the activity to go to. */
|
|
506
|
-
id: string;
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Types of values that can be stored in the session dictonary.
|
|
510
|
-
*/
|
|
511
|
-
type SessionDictionaryValues = string | number | boolean | object | null | undefined;
|
|
512
|
-
|
|
513
|
-
interface Activity {
|
|
514
|
-
/** The type of activity: Game or Survey */
|
|
515
|
-
type: ActivityType;
|
|
516
|
-
/** Initializes the activity. All code to create the activity's appearance and behavior must be placed in this method. This method is asynchronous, and must be awaited. When writing a new game by extending the `Game` class, this method will be overridden, but the base method must still be called with `await super.init()`. */
|
|
517
|
-
init(): Promise<void>;
|
|
518
|
-
/** Starts the activity */
|
|
519
|
-
start(): Promise<void>;
|
|
520
|
-
/** Stops the activity */
|
|
521
|
-
stop(): void;
|
|
522
|
-
/** The activity's parent session */
|
|
523
|
-
session: Session;
|
|
524
|
-
/** The activity's unique identifier. NOTE: This is newly generated each session. The uuid for an activity will vary across sessions. */
|
|
525
|
-
uuid: string;
|
|
526
|
-
/** Human-friendly name of this activity */
|
|
527
|
-
name: string;
|
|
528
|
-
/** Short identifier of this activity */
|
|
529
|
-
id: string;
|
|
530
|
-
/** The value of performance.now() immediately before the activity begins */
|
|
531
|
-
beginTimestamp: number;
|
|
532
|
-
/** The value of new Date().toISOString() immediately before the activity begins */
|
|
533
|
-
beginIso8601Timestamp: string;
|
|
534
|
-
/** Sets additional activity parameters if defaults are not sufficient. */
|
|
535
|
-
setParameters(additionalParameters: unknown): void;
|
|
536
|
-
/** Additional activity parameters that were set. */
|
|
537
|
-
readonly additionalParameters?: unknown;
|
|
538
|
-
/** Optional store to use for saving data. The implementation of the store is not provided by the \@m2c2kit/core library. */
|
|
539
|
-
dataStore?: IDataStore;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Base interface for all m2c2kit events.
|
|
544
|
-
*
|
|
545
|
-
* @remarks I would have named it Event, but that would collide with
|
|
546
|
-
* the existing DOM Event
|
|
547
|
-
*/
|
|
548
|
-
interface EventBase {
|
|
549
|
-
/** Type of event. */
|
|
550
|
-
type: EventType;
|
|
551
|
-
/** The object on which the event occurred. */
|
|
552
|
-
target: Entity | Session | Activity;
|
|
553
|
-
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
554
|
-
handled?: boolean;
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* The different events that are dispatched by m2c2kit.
|
|
558
|
-
*/
|
|
559
|
-
declare enum EventType {
|
|
560
|
-
SessionInitialize = "SessionInitialize",
|
|
561
|
-
SessionStart = "SessionStart",
|
|
562
|
-
SessionEnd = "SessionEnd",
|
|
563
|
-
ActivityStart = "ActivityStart",
|
|
564
|
-
ActivityEnd = "ActivityEnd",
|
|
565
|
-
ActivityCancel = "ActivityCancel",
|
|
566
|
-
ActivityData = "ActivityData",
|
|
567
|
-
TapDown = "TapDown",
|
|
568
|
-
TapUp = "TapUp",
|
|
569
|
-
TapUpAny = "TapUpAny",
|
|
570
|
-
TapLeave = "TapLeave",
|
|
571
|
-
PointerDown = "PointerDown",
|
|
572
|
-
PointerUp = "PointerUp",
|
|
573
|
-
PointerMove = "PointerMove",
|
|
574
|
-
Drag = "Drag",
|
|
575
|
-
DragStart = "DragStart",
|
|
576
|
-
DragEnd = "DragEnd",
|
|
577
|
-
CompositeCustom = "CompositeCustom"
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
/** Base interface for all Entity events. */
|
|
581
|
-
interface EntityEvent extends EventBase {
|
|
582
|
-
/** The Entity on which the event occurred. */
|
|
583
|
-
target: Entity;
|
|
584
|
-
/** For composites that raise events, type of the composite custom event. */
|
|
585
|
-
compositeType?: string;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
interface EntityEventListener {
|
|
589
|
-
type: EventType;
|
|
590
|
-
/** For composites that raise events, type of the composite custom event. */
|
|
591
|
-
compositeType?: string;
|
|
592
|
-
entityUuid: string;
|
|
593
|
-
callback: (event: EntityEvent) => void;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Position in two-dimensional space.
|
|
598
|
-
*/
|
|
599
|
-
interface Point {
|
|
600
|
-
/** Horizonal coordinate */
|
|
601
|
-
x: number;
|
|
602
|
-
/** Vertical coordinate */
|
|
603
|
-
y: number;
|
|
339
|
+
dispose(): void;
|
|
340
|
+
anchorPoint: Point;
|
|
341
|
+
zPosition: number;
|
|
604
342
|
}
|
|
605
343
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
point: Point;
|
|
615
|
-
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
616
|
-
buttons: number;
|
|
344
|
+
declare enum EntityType {
|
|
345
|
+
Entity = "Entity",
|
|
346
|
+
Scene = "Scene",
|
|
347
|
+
Sprite = "Sprite",
|
|
348
|
+
Label = "Label",
|
|
349
|
+
TextLine = "TextLine",
|
|
350
|
+
Shape = "Shape",
|
|
351
|
+
Composite = "Composite"
|
|
617
352
|
}
|
|
618
353
|
|
|
619
354
|
/**
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* @remarks Unlike M2PointerEvent, TapEvent considers how the pointer, while
|
|
623
|
-
* in the down state, moves in relation to the bounds of the entity.
|
|
355
|
+
* Color in red (0-255), green (0-255), blue (0-255), alpha (0-1) format. Must be numeric array of length 4.
|
|
624
356
|
*/
|
|
625
|
-
|
|
626
|
-
/** Point that was tapped on entity, relative to the entity coordinate system */
|
|
627
|
-
point: Point;
|
|
628
|
-
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
629
|
-
buttons: number;
|
|
630
|
-
}
|
|
357
|
+
type RgbaColor = [number, number, number, number];
|
|
631
358
|
|
|
632
359
|
interface DrawableOptions {
|
|
633
360
|
/** Point within the entity that determines its position. Default is \{ x: 0.5, y: 0.5 \}, which centers the entity on its position */
|
|
@@ -666,123 +393,35 @@ interface Constraints {
|
|
|
666
393
|
}
|
|
667
394
|
|
|
668
395
|
/**
|
|
669
|
-
* The Layout allows relative positioning via constraints.
|
|
670
|
-
* This is not fully implemented yet: DO NOT USE!
|
|
671
|
-
* We use it internally for instructions.
|
|
672
|
-
*/
|
|
673
|
-
interface Layout {
|
|
674
|
-
height?: number;
|
|
675
|
-
width?: number;
|
|
676
|
-
marginStart?: number;
|
|
677
|
-
marginEnd?: number;
|
|
678
|
-
marginTop?: number;
|
|
679
|
-
marginBottom?: number;
|
|
680
|
-
constraints?: Constraints;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Color in red (0-255), green (0-255), blue (0-255), alpha (0-1) format. Must be numeric array of length 4.
|
|
685
|
-
*/
|
|
686
|
-
type RgbaColor = [number, number, number, number];
|
|
687
|
-
|
|
688
|
-
interface TextOptions {
|
|
689
|
-
/** Text to be displayed */
|
|
690
|
-
text?: string;
|
|
691
|
-
/** Name of font to use for text. Must have been previously loaded */
|
|
692
|
-
fontName?: string;
|
|
693
|
-
/** Color of text. Default is Constants.DEFAULT_FONT_COLOR (WebColors.Black) */
|
|
694
|
-
fontColor?: RgbaColor;
|
|
695
|
-
/** Size of text. Default is Constants.DEFAULT_FONT_SIZE (16) */
|
|
696
|
-
fontSize?: number;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Width and height on two-dimensional space
|
|
701
|
-
*/
|
|
702
|
-
interface Size {
|
|
703
|
-
/** Horizonal width, x-axis */
|
|
704
|
-
width: number;
|
|
705
|
-
/** Vertical height, y-axis */
|
|
706
|
-
height: number;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
interface EntityOptions {
|
|
710
|
-
/** Name of the entity. Only needed if the entity will be referred to by name in a later function */
|
|
711
|
-
name?: string;
|
|
712
|
-
/** Position of the entity within its parent coordinate system. Default is (0, 0) */
|
|
713
|
-
position?: Point;
|
|
714
|
-
/** Scale of the entity. Default is 1.0 */
|
|
715
|
-
scale?: number;
|
|
716
|
-
/** Does the entity respond to user events, such as taps? Default is false */
|
|
717
|
-
isUserInteractionEnabled?: boolean;
|
|
718
|
-
/** Can the entity be dragged? */
|
|
719
|
-
draggable?: boolean;
|
|
720
|
-
/** Is the entity, and its children, hidden? (not displayed). Default is false */
|
|
721
|
-
hidden?: boolean;
|
|
722
|
-
/** FOR INTERNAL USE ONLY */
|
|
723
|
-
layout?: Layout;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
declare enum EntityType {
|
|
727
|
-
Entity = "Entity",
|
|
728
|
-
Scene = "Scene",
|
|
729
|
-
Sprite = "Sprite",
|
|
730
|
-
Label = "Label",
|
|
731
|
-
TextLine = "TextLine",
|
|
732
|
-
Shape = "Shape",
|
|
733
|
-
Composite = "Composite"
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
type EasingFunction = (
|
|
737
|
-
/** elapsed time since start of action */
|
|
738
|
-
t: number,
|
|
739
|
-
/** start value of value to be eased */
|
|
740
|
-
b: number,
|
|
741
|
-
/** total change of value to be eased */
|
|
742
|
-
c: number,
|
|
743
|
-
/** total duration of action */
|
|
744
|
-
d: number) => number;
|
|
745
|
-
/**
|
|
746
|
-
* The Easings class has static methods for creating easings to be used in actions.
|
|
747
|
-
*/
|
|
748
|
-
declare class Easings {
|
|
749
|
-
static none: EasingFunction;
|
|
750
|
-
static linear: EasingFunction;
|
|
751
|
-
static quadraticIn: EasingFunction;
|
|
752
|
-
static quadraticOut: EasingFunction;
|
|
753
|
-
static quadraticInOut: EasingFunction;
|
|
754
|
-
static cubicIn: EasingFunction;
|
|
755
|
-
static cubicOut: EasingFunction;
|
|
756
|
-
static cubicInOut: EasingFunction;
|
|
757
|
-
static quarticIn: EasingFunction;
|
|
758
|
-
static quarticOut: EasingFunction;
|
|
759
|
-
static quarticInOut: EasingFunction;
|
|
760
|
-
static quinticIn: EasingFunction;
|
|
761
|
-
static quinticOut: EasingFunction;
|
|
762
|
-
static quinticInOut: EasingFunction;
|
|
763
|
-
static sinusoidalIn: EasingFunction;
|
|
764
|
-
static sinusoidalOut: EasingFunction;
|
|
765
|
-
static sinusoidalInOut: EasingFunction;
|
|
766
|
-
static exponentialIn: EasingFunction;
|
|
767
|
-
static exponentialOut: EasingFunction;
|
|
768
|
-
static exponentialInOut: EasingFunction;
|
|
769
|
-
static circularIn: EasingFunction;
|
|
770
|
-
static circularOut: EasingFunction;
|
|
771
|
-
static circularInOut: EasingFunction;
|
|
396
|
+
* The Layout allows relative positioning via constraints.
|
|
397
|
+
* This is not fully implemented yet: DO NOT USE!
|
|
398
|
+
* We use it internally for instructions.
|
|
399
|
+
*/
|
|
400
|
+
interface Layout {
|
|
401
|
+
height?: number;
|
|
402
|
+
width?: number;
|
|
403
|
+
marginStart?: number;
|
|
404
|
+
marginEnd?: number;
|
|
405
|
+
marginTop?: number;
|
|
406
|
+
marginBottom?: number;
|
|
407
|
+
constraints?: Constraints;
|
|
772
408
|
}
|
|
773
409
|
|
|
774
|
-
interface
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
410
|
+
interface EntityOptions {
|
|
411
|
+
/** Name of the entity. Only needed if the entity will be referred to by name in a later function */
|
|
412
|
+
name?: string;
|
|
413
|
+
/** Position of the entity within its parent coordinate system. Default is (0, 0) */
|
|
414
|
+
position?: Point;
|
|
415
|
+
/** Scale of the entity. Default is 1.0 */
|
|
416
|
+
scale?: number;
|
|
417
|
+
/** Does the entity respond to user events, such as taps? Default is false */
|
|
418
|
+
isUserInteractionEnabled?: boolean;
|
|
419
|
+
/** Can the entity be dragged? */
|
|
420
|
+
draggable?: boolean;
|
|
421
|
+
/** Is the entity, and its children, hidden? (not displayed). Default is false */
|
|
422
|
+
hidden?: boolean;
|
|
423
|
+
/** FOR INTERNAL USE ONLY */
|
|
424
|
+
layout?: Layout;
|
|
786
425
|
}
|
|
787
426
|
|
|
788
427
|
interface SceneOptions extends EntityOptions, DrawableOptions {
|
|
@@ -862,7 +501,7 @@ declare class Scene extends Entity implements IDrawable, SceneOptions {
|
|
|
862
501
|
interface SlideTransitionOptions {
|
|
863
502
|
/** Direction in which the slide action goes */
|
|
864
503
|
direction: TransitionDirection;
|
|
865
|
-
/** Duration, in
|
|
504
|
+
/** Duration, in milliseconds, of the transition */
|
|
866
505
|
duration: number;
|
|
867
506
|
/** Easing function for movement; default is linear */
|
|
868
507
|
easing?: EasingFunction;
|
|
@@ -915,6 +554,14 @@ declare class SceneTransition {
|
|
|
915
554
|
constructor(scene: Scene, transition: Transition);
|
|
916
555
|
}
|
|
917
556
|
|
|
557
|
+
/** Base interface for all Entity events. */
|
|
558
|
+
interface EntityEvent extends EventBase {
|
|
559
|
+
/** The Entity on which the event occurred. */
|
|
560
|
+
target: Entity;
|
|
561
|
+
/** For composites that raise events, type of the composite custom event. */
|
|
562
|
+
compositeType?: string;
|
|
563
|
+
}
|
|
564
|
+
|
|
918
565
|
/**
|
|
919
566
|
* TrialSchema defines the data that are generated for each trial. They are
|
|
920
567
|
* key-value pairs in which the key is the variable name, and the value is
|
|
@@ -961,6 +608,16 @@ interface Translations {
|
|
|
961
608
|
};
|
|
962
609
|
}
|
|
963
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Font asset to use in the game.
|
|
613
|
+
*/
|
|
614
|
+
interface FontAsset {
|
|
615
|
+
/** Name of the font to use when referring to it within m2c2kit */
|
|
616
|
+
fontName: string;
|
|
617
|
+
/** URL of font (TrueType font) to load */
|
|
618
|
+
url: string;
|
|
619
|
+
}
|
|
620
|
+
|
|
964
621
|
/**
|
|
965
622
|
* Options to specify HTML canvas, set game canvas size, and load game assets.
|
|
966
623
|
*/
|
|
@@ -989,8 +646,8 @@ interface GameOptions {
|
|
|
989
646
|
trialSchema?: TrialSchema;
|
|
990
647
|
/** Default game parameters; JSON object where key is the game parameter, value is default value */
|
|
991
648
|
parameters?: GameParameters;
|
|
992
|
-
/**
|
|
993
|
-
|
|
649
|
+
/** Font assets to use. The first element will be the default font */
|
|
650
|
+
fonts?: Array<FontAsset>;
|
|
994
651
|
/** Array of BrowserImage objects to render and load */
|
|
995
652
|
images?: Array<BrowserImage>;
|
|
996
653
|
/** Show FPS in upper left corner? Default is false */
|
|
@@ -1009,6 +666,8 @@ interface GameOptions {
|
|
|
1009
666
|
translations?: Translations;
|
|
1010
667
|
/** Show logs for WebGl activity? */
|
|
1011
668
|
logWebGl?: boolean;
|
|
669
|
+
/** URL of game assets folder, if not the default location of "assets/id of game from GameOptions" */
|
|
670
|
+
assetsUrl?: string;
|
|
1012
671
|
}
|
|
1013
672
|
|
|
1014
673
|
interface GameData extends ActivityKeyValueData {
|
|
@@ -1021,7 +680,7 @@ interface GameData extends ActivityKeyValueData {
|
|
|
1021
680
|
interface LocalizationOptions {
|
|
1022
681
|
/** Locale to use for localization, or "auto" to request from the environment. */
|
|
1023
682
|
locale: string;
|
|
1024
|
-
/** Locale to use if requested locale translation is not
|
|
683
|
+
/** Locale to use if requested locale translation is not available, or if "auto" locale was requested and environment cannot provide a locale. */
|
|
1025
684
|
fallbackLocale?: string;
|
|
1026
685
|
/** Font color for strings that are missing translation and use the fallback locale or untranslated string. */
|
|
1027
686
|
missingTranslationFontColor?: RgbaColor;
|
|
@@ -1069,6 +728,9 @@ declare class Game implements Activity {
|
|
|
1069
728
|
private loaderElementsRemoved;
|
|
1070
729
|
private _dataStore?;
|
|
1071
730
|
additionalParameters?: unknown;
|
|
731
|
+
staticTrialSchema: {
|
|
732
|
+
[key: string]: JsonSchemaDataTypeScriptTypes;
|
|
733
|
+
};
|
|
1072
734
|
/**
|
|
1073
735
|
* The base class for all games. New games should extend this class.
|
|
1074
736
|
*
|
|
@@ -1216,7 +878,7 @@ declare class Game implements Activity {
|
|
|
1216
878
|
*
|
|
1217
879
|
* @remarks Once added to the game, a free entity will always be drawn,
|
|
1218
880
|
* and it will not be part of any scene transitions. This is useful if
|
|
1219
|
-
* an entity must
|
|
881
|
+
* an entity must persistently be drawn and not move with scene
|
|
1220
882
|
* transitions. The appearance of the free entity must be managed
|
|
1221
883
|
* by the programmer. Note: internally, the free entities are part of a
|
|
1222
884
|
* special scene (named "__freeEntitiesScene"), but this scene is handled
|
|
@@ -1368,7 +1030,44 @@ declare class Game implements Activity {
|
|
|
1368
1030
|
* @param variableName - variable to be set
|
|
1369
1031
|
* @param value - value of the variable to set
|
|
1370
1032
|
*/
|
|
1371
|
-
addTrialData(variableName: string, value:
|
|
1033
|
+
addTrialData(variableName: string, value: JsonSchemaDataTypeScriptTypes): void;
|
|
1034
|
+
/**
|
|
1035
|
+
* Adds custom trial schema to the game's trialSchema object.
|
|
1036
|
+
*
|
|
1037
|
+
* @param schema - Trial schema to add
|
|
1038
|
+
*
|
|
1039
|
+
* @remarks This is useful if you want to add custom trial variables.
|
|
1040
|
+
* This must be done before Session.start() is called, because
|
|
1041
|
+
* Session.start() will call Game.start(), which will initialize
|
|
1042
|
+
* the trial schema.
|
|
1043
|
+
*/
|
|
1044
|
+
addTrialSchema(schema: TrialSchema): void;
|
|
1045
|
+
/**
|
|
1046
|
+
* Sets the value of a variable that will be the same for all trials.
|
|
1047
|
+
*
|
|
1048
|
+
* @remarks This sets the value of a variable that is the same across
|
|
1049
|
+
* all trials ("static"). This is useful for variables that are not
|
|
1050
|
+
* part of the trial schema, but that you want to save for each trial in
|
|
1051
|
+
* your use case. For example, you might want to save the subject's
|
|
1052
|
+
* participant ID for each trial, but this is not part of the trial schema.
|
|
1053
|
+
* Rather than modify the source code for the game, you can do the following
|
|
1054
|
+
* to ensure that the participant ID is saved for each trial:
|
|
1055
|
+
*
|
|
1056
|
+
* game.addTrialSchema({
|
|
1057
|
+
* participant_id: {
|
|
1058
|
+
* type: "string",
|
|
1059
|
+
* description: "ID of the participant",
|
|
1060
|
+
* }
|
|
1061
|
+
* });
|
|
1062
|
+
* game.addStaticTrialData("participant_id", "12345");
|
|
1063
|
+
*
|
|
1064
|
+
* When Game.trialComplete() is called, the participant_id variable will
|
|
1065
|
+
* be saved for the trial with the value "12345".
|
|
1066
|
+
*
|
|
1067
|
+
* @param variableName - variable to be set
|
|
1068
|
+
* @param value - value of the variable to set
|
|
1069
|
+
*/
|
|
1070
|
+
addStaticTrialData(variableName: string, value: JsonSchemaDataTypeScriptTypes): void;
|
|
1372
1071
|
/**
|
|
1373
1072
|
* Should be called when the current trial has completed. It will
|
|
1374
1073
|
* also increment the trial index.
|
|
@@ -1446,85 +1145,443 @@ declare class Game implements Activity {
|
|
|
1446
1145
|
* must be queued and completed once a draw cycle has completed. See
|
|
1447
1146
|
* the loop() method.
|
|
1448
1147
|
*
|
|
1449
|
-
* @param sx - Upper left coordinate of screenshot
|
|
1450
|
-
* @param sy - Upper right coordinate of screenshot
|
|
1451
|
-
* @param sw - width of area to screenshot
|
|
1452
|
-
* @param sh -
|
|
1453
|
-
* @returns Promise of Uint8Array of image data
|
|
1148
|
+
* @param sx - Upper left coordinate of screenshot
|
|
1149
|
+
* @param sy - Upper right coordinate of screenshot
|
|
1150
|
+
* @param sw - width of area to screenshot
|
|
1151
|
+
* @param sh - height of area to screenshot
|
|
1152
|
+
* @returns Promise of Uint8Array of image data
|
|
1153
|
+
*/
|
|
1154
|
+
takeScreenshot(sx?: number, sy?: number, sw?: number, sh?: number): Promise<Uint8Array | null>;
|
|
1155
|
+
private animateSceneTransition;
|
|
1156
|
+
private drawFps;
|
|
1157
|
+
/**
|
|
1158
|
+
* Creates an event listener for an entity based on the entity name
|
|
1159
|
+
*
|
|
1160
|
+
* @remarks Typically, event listeners will be created using a method specific to the event, such as onTapDown(). This alternative allows creation with entity name.
|
|
1161
|
+
*
|
|
1162
|
+
* @param type - the type of event to listen for, e.g., "tapDown"
|
|
1163
|
+
* @param entityName - the entity name for which an event will be listened
|
|
1164
|
+
* @param callback
|
|
1165
|
+
* @param replaceExistingCallback
|
|
1166
|
+
*/
|
|
1167
|
+
createEventListener(type: EventType, entityName: string, callback: (event: EntityEvent) => void, replaceExistingCallback?: boolean): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Returns array of all entities that have been added to the game object.
|
|
1170
|
+
*/
|
|
1171
|
+
get entities(): Array<Entity>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Receives callback from DOM PointerDown event
|
|
1174
|
+
*
|
|
1175
|
+
* @param domPointerEvent - PointerEvent from the DOM
|
|
1176
|
+
* @returns
|
|
1177
|
+
*/
|
|
1178
|
+
private htmlCanvasPointerDownHandler;
|
|
1179
|
+
private htmlCanvasPointerUpHandler;
|
|
1180
|
+
private htmlCanvasPointerMoveHandler;
|
|
1181
|
+
/**
|
|
1182
|
+
* Adjusts dragging behavior when the pointer leaves the canvas
|
|
1183
|
+
*
|
|
1184
|
+
* @remarks This is necessary because the pointerup event is not fired when
|
|
1185
|
+
* the pointer leaves the canvas. On desktop, this means that the user might
|
|
1186
|
+
* lift the pointer outside the canvas, but the entity will still be dragged
|
|
1187
|
+
* when the pointer is moved back into the canvas.
|
|
1188
|
+
*
|
|
1189
|
+
* @param domPointerEvent
|
|
1190
|
+
* @returns
|
|
1191
|
+
*/
|
|
1192
|
+
private htmlCanvasPointerLeaveHandler;
|
|
1193
|
+
/**
|
|
1194
|
+
* Determines if/how m2c2kit entities respond to the DOM PointerDown event
|
|
1195
|
+
*
|
|
1196
|
+
* @param entity - entity that might be affected by the DOM PointerDown event
|
|
1197
|
+
* @param m2Event
|
|
1198
|
+
* @param domPointerEvent
|
|
1199
|
+
*/
|
|
1200
|
+
private processDomPointerDown;
|
|
1201
|
+
private processDomPointerUp;
|
|
1202
|
+
private processDomPointerMove;
|
|
1203
|
+
private raiseM2PointerDownEvent;
|
|
1204
|
+
private raiseTapDownEvent;
|
|
1205
|
+
private raiseTapLeaveEvent;
|
|
1206
|
+
private raiseM2PointerUpEvent;
|
|
1207
|
+
private raiseTapUpEvent;
|
|
1208
|
+
private raiseTapUpAny;
|
|
1209
|
+
private raiseM2PointerMoveEvent;
|
|
1210
|
+
private raiseM2DragStartEvent;
|
|
1211
|
+
private raiseM2DragEvent;
|
|
1212
|
+
private raiseM2DragEndEvent;
|
|
1213
|
+
private calculatePointWithinEntityFromDomPointerEvent;
|
|
1214
|
+
private raiseEventOnListeningEntities;
|
|
1215
|
+
private sceneCanReceiveUserInteraction;
|
|
1216
|
+
/**
|
|
1217
|
+
*
|
|
1218
|
+
* Checks if the given canvas point is within the entity's bounds.
|
|
1219
|
+
*
|
|
1220
|
+
* @param entity - entity to check bounds for
|
|
1221
|
+
* @param x - x coordinate of the canvas point
|
|
1222
|
+
* @param y - y coordinate of the canvas point
|
|
1223
|
+
* @returns true if x, y point is within the entity's bounds
|
|
1224
|
+
*/
|
|
1225
|
+
private IsCanvasPointWithinEntityBounds;
|
|
1226
|
+
private calculateEntityAbsoluteBoundingBox;
|
|
1227
|
+
prependAssetsGameIdUrl(url: string): string;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* This class contains all the fonts for all the games in the activity.
|
|
1232
|
+
* Fonts have been converted to canvaskit Typeface.
|
|
1233
|
+
*
|
|
1234
|
+
* @remarks fontName is how the user will refer to the font in the game.
|
|
1235
|
+
* fontFamily is the name of the font as it was specified within the TTF file.
|
|
1236
|
+
* We must retain the fontFamily name because we must provide fontFamily (not
|
|
1237
|
+
* fontName!) to canvaskit when rendering paragraphs.
|
|
1238
|
+
*/
|
|
1239
|
+
declare class GameTypefaces {
|
|
1240
|
+
[gameUuid: string]: {
|
|
1241
|
+
[fontName: string]: {
|
|
1242
|
+
fontFamily: string;
|
|
1243
|
+
typeface: Typeface;
|
|
1244
|
+
isDefault: boolean;
|
|
1245
|
+
};
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Class for loading, preparing, and providing fonts to games.
|
|
1250
|
+
*
|
|
1251
|
+
* @remarks FOR INTERNAL USE ONLY
|
|
1252
|
+
*/
|
|
1253
|
+
declare class FontManager {
|
|
1254
|
+
canvasKit?: CanvasKit;
|
|
1255
|
+
fontMgr?: FontMgr;
|
|
1256
|
+
gameTypefaces: GameTypefaces;
|
|
1257
|
+
fontData: Array<FontData>;
|
|
1258
|
+
session: Session;
|
|
1259
|
+
games?: Array<Game>;
|
|
1260
|
+
constructor(session: Session);
|
|
1261
|
+
/**
|
|
1262
|
+
* Gets a typeface that was previously loaded for the specified game.
|
|
1263
|
+
*
|
|
1264
|
+
* @param gameUuid
|
|
1265
|
+
* @param fontName
|
|
1266
|
+
* @returns the requested Typeface
|
|
1267
|
+
*/
|
|
1268
|
+
getTypeface(gameUuid: string, fontName: string): Typeface;
|
|
1269
|
+
/**
|
|
1270
|
+
* Gets names of fonts loaded for the specified game.
|
|
1271
|
+
*
|
|
1272
|
+
* @param gameUuid
|
|
1273
|
+
* @returns array of font names
|
|
1274
|
+
*/
|
|
1275
|
+
getFontNames(gameUuid: string): Array<string>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Fetches all fonts games.
|
|
1278
|
+
*
|
|
1279
|
+
* @param games - array of games
|
|
1280
|
+
* @returns
|
|
1281
|
+
*/
|
|
1282
|
+
fetchFonts(games: Array<Game>): Promise<void[]>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Takes the fonts, which have been previously fetched and converted into
|
|
1285
|
+
* Array Buffers using FontManager.fetchFonts(), and makes them available
|
|
1286
|
+
* to our engine by creating canvaskit Typefaces.
|
|
1287
|
+
*/
|
|
1288
|
+
loadAllGamesFontData(): void;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Notifies when an activity starts, ends, cancels, or
|
|
1293
|
+
* creates data.
|
|
1294
|
+
*/
|
|
1295
|
+
interface ActivityLifecycleEvent extends ActivityEvent {
|
|
1296
|
+
results?: ActivityResults;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
interface ActivityCallbacks {
|
|
1300
|
+
/** Callback executed when the activity lifecycle changes, such as when it ends. */
|
|
1301
|
+
onActivityLifecycle?: (event: ActivityLifecycleEvent) => void;
|
|
1302
|
+
/** Callback executed when an activity creates some data. */
|
|
1303
|
+
onActivityResults?: (event: ActivityResultsEvent) => void;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/** Base interface for all Session events. */
|
|
1307
|
+
interface SessionEvent extends EventBase {
|
|
1308
|
+
target: Session;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Notifies when a session starts, ends, or initializes.
|
|
1313
|
+
*/
|
|
1314
|
+
interface SessionLifecycleEvent extends SessionEvent {
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
interface SessionCallbacks {
|
|
1318
|
+
/** Callback executed when the session lifecycle changes, such as when it is initialized. */
|
|
1319
|
+
onSessionLifecycle?: (event: SessionLifecycleEvent) => void;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
interface SessionOptions {
|
|
1323
|
+
/** The activities that compose this session */
|
|
1324
|
+
activities: Array<Activity>;
|
|
1325
|
+
/** Callbacks executed when activity events occurs, such as when activity creates data or ends */
|
|
1326
|
+
activityCallbacks?: ActivityCallbacks;
|
|
1327
|
+
/** Callbacks executed when session events occur */
|
|
1328
|
+
sessionCallbacks?: SessionCallbacks;
|
|
1329
|
+
/** Url of the canvaskit.wasm binary. Always set to the default value of "canvaskit.wasm" */
|
|
1330
|
+
canvasKitWasmUrl: "canvaskit.wasm";
|
|
1331
|
+
/** Use a specified session UUID, rather than create a new one */
|
|
1332
|
+
sessionUuid?: string;
|
|
1333
|
+
/** URL of session assets folder (which contains wasm binary), if not the default location of "assets" */
|
|
1334
|
+
assetsUrl?: string;
|
|
1335
|
+
/** NOT IMPLEMENTED YET: Orientation the screen should be locked to for this session. Value will be passed into the ScreenOrientation.lock() Web API. */
|
|
1336
|
+
orientation?: "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
declare class Session {
|
|
1340
|
+
options: SessionOptions;
|
|
1341
|
+
fontManager: FontManager;
|
|
1342
|
+
imageManager: ImageManager;
|
|
1343
|
+
currentActivity?: Activity;
|
|
1344
|
+
uuid: string;
|
|
1345
|
+
dataStore?: IDataStore;
|
|
1346
|
+
private sessionDictionary;
|
|
1347
|
+
private canvasKit?;
|
|
1348
|
+
private version;
|
|
1349
|
+
/**
|
|
1350
|
+
* A Session contains one or more activities. The session manages the start
|
|
1351
|
+
* and stop of activities, and advancement to next activity
|
|
1352
|
+
*
|
|
1353
|
+
* @param options
|
|
1354
|
+
*/
|
|
1355
|
+
constructor(options: SessionOptions);
|
|
1356
|
+
/**
|
|
1357
|
+
* Asynchronously initializes the m2c2kit engine and loads assets
|
|
1358
|
+
*/
|
|
1359
|
+
init(): Promise<void>;
|
|
1360
|
+
/**
|
|
1361
|
+
* Starts the session and starts the first activity.
|
|
1362
|
+
*/
|
|
1363
|
+
start(): Promise<void>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Declares the session ended and sends callback.
|
|
1366
|
+
*/
|
|
1367
|
+
end(): void;
|
|
1368
|
+
private stop;
|
|
1369
|
+
/**
|
|
1370
|
+
* Frees up resources that were allocated to run the session.
|
|
1371
|
+
*
|
|
1372
|
+
* @remarks This will be done automatically by the m2c2kit library;
|
|
1373
|
+
* the end-user must not call this.
|
|
1454
1374
|
*/
|
|
1455
|
-
|
|
1456
|
-
private animateSceneTransition;
|
|
1457
|
-
private drawFps;
|
|
1375
|
+
private dispose;
|
|
1458
1376
|
/**
|
|
1459
|
-
*
|
|
1377
|
+
* Stops the current activity and goes to the activity with the provided id.
|
|
1460
1378
|
*
|
|
1461
|
-
* @
|
|
1379
|
+
* @param options
|
|
1380
|
+
*/
|
|
1381
|
+
goToActivity(options: GoToActivityOptions): Promise<void>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Stops the current activity and advances to next activity in the session.
|
|
1384
|
+
* If there is no activity after the current activity, throws error.
|
|
1385
|
+
*/
|
|
1386
|
+
goToNextActivity(): Promise<void>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Stops the current activity and advances to next activity in the session.
|
|
1389
|
+
* If there is no activity after the current activity, throws error.
|
|
1462
1390
|
*
|
|
1463
|
-
* @
|
|
1464
|
-
* @param entityName - the entity name for which an event will be listened
|
|
1465
|
-
* @param callback
|
|
1466
|
-
* @param replaceExistingCallback
|
|
1391
|
+
* @deprecated Use goToNextActivity() instead.
|
|
1467
1392
|
*/
|
|
1468
|
-
|
|
1393
|
+
advanceToNextActivity(): Promise<void>;
|
|
1469
1394
|
/**
|
|
1470
|
-
*
|
|
1395
|
+
* Gets the next activity after the current one, or undefined if
|
|
1396
|
+
* this is the last activity.
|
|
1471
1397
|
*/
|
|
1472
|
-
get
|
|
1398
|
+
get nextActivity(): Activity | undefined;
|
|
1473
1399
|
/**
|
|
1474
|
-
*
|
|
1400
|
+
* Saves an item to the session's key-value dictionary.
|
|
1475
1401
|
*
|
|
1476
|
-
* @
|
|
1477
|
-
*
|
|
1402
|
+
* @remarks The session dictionary is not persisted. It is available only
|
|
1403
|
+
* during the actively running session. It is useful for storing temporary
|
|
1404
|
+
* data to coordinate between activities.
|
|
1405
|
+
*
|
|
1406
|
+
* @param key - item key
|
|
1407
|
+
* @param value - item value
|
|
1478
1408
|
*/
|
|
1479
|
-
|
|
1480
|
-
private htmlCanvasPointerUpHandler;
|
|
1481
|
-
private htmlCanvasPointerMoveHandler;
|
|
1409
|
+
dictionarySetItem(key: string, value: SessionDictionaryValues): void;
|
|
1482
1410
|
/**
|
|
1483
|
-
*
|
|
1411
|
+
* Gets an item value from the session's key-value dictionary.
|
|
1484
1412
|
*
|
|
1485
|
-
* @remarks
|
|
1486
|
-
* the
|
|
1487
|
-
*
|
|
1488
|
-
* when the pointer is moved back into the canvas.
|
|
1413
|
+
* @remarks The session dictionary is not persisted. It is available only
|
|
1414
|
+
* during the actively running session. It is useful for storing temporary
|
|
1415
|
+
* data to coordinate between activities.
|
|
1489
1416
|
*
|
|
1490
|
-
* @param
|
|
1491
|
-
* @returns
|
|
1417
|
+
* @param key - item key
|
|
1418
|
+
* @returns value of the item
|
|
1492
1419
|
*/
|
|
1493
|
-
|
|
1420
|
+
dictionaryGetItem<T extends SessionDictionaryValues>(key: string): T;
|
|
1494
1421
|
/**
|
|
1495
|
-
*
|
|
1422
|
+
* Deletes an item value from the session's key-value dictionary.
|
|
1496
1423
|
*
|
|
1497
|
-
* @
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1424
|
+
* @remarks The session dictionary is not persisted. It is available only
|
|
1425
|
+
* during the actively running session. It is useful for storing temporary
|
|
1426
|
+
* data to coordinate between activities.
|
|
1427
|
+
*
|
|
1428
|
+
* @param key - item key
|
|
1429
|
+
* @returns true if the item was deleted, false if it did not exist
|
|
1500
1430
|
*/
|
|
1501
|
-
|
|
1502
|
-
private processDomPointerUp;
|
|
1503
|
-
private processDomPointerMove;
|
|
1504
|
-
private raiseM2PointerDownEvent;
|
|
1505
|
-
private raiseTapDownEvent;
|
|
1506
|
-
private raiseTapLeaveEvent;
|
|
1507
|
-
private raiseM2PointerUpEvent;
|
|
1508
|
-
private raiseTapUpEvent;
|
|
1509
|
-
private raiseTapUpAny;
|
|
1510
|
-
private raiseM2PointerMoveEvent;
|
|
1511
|
-
private raiseM2DragStartEvent;
|
|
1512
|
-
private raiseM2DragEvent;
|
|
1513
|
-
private raiseM2DragEndEvent;
|
|
1514
|
-
private calculatePointWithinEntityFromDomPointerEvent;
|
|
1515
|
-
private raiseEventOnListeningEntities;
|
|
1516
|
-
private sceneCanReceiveUserInteraction;
|
|
1431
|
+
dictionaryDeleteItem(key: string): boolean;
|
|
1517
1432
|
/**
|
|
1433
|
+
* Determines if a key exists in the activity's key-value dictionary.
|
|
1518
1434
|
*
|
|
1519
|
-
*
|
|
1435
|
+
* @remarks The session dictionary is not persisted. It is available only
|
|
1436
|
+
* during the actively running session. It is useful for storing temporary
|
|
1437
|
+
* data to coordinate between activities.
|
|
1520
1438
|
*
|
|
1521
|
-
* @param
|
|
1522
|
-
* @
|
|
1523
|
-
* @param y - y coordinate of the canvas point
|
|
1524
|
-
* @returns true if x, y point is within the entity's bounds
|
|
1439
|
+
* @param key - item key
|
|
1440
|
+
* @returns true if the key exists, false otherwise
|
|
1525
1441
|
*/
|
|
1526
|
-
|
|
1527
|
-
|
|
1442
|
+
dictionaryItemExists(key: string): boolean;
|
|
1443
|
+
/**
|
|
1444
|
+
* Gets asynchronous assets, including initialization of canvaskit wasm,
|
|
1445
|
+
* fetching of fonts from specified urls, and rendering and fetching
|
|
1446
|
+
* of images
|
|
1447
|
+
* @returns
|
|
1448
|
+
*/
|
|
1449
|
+
private getAsynchronousAssets;
|
|
1450
|
+
private loadCanvasKit;
|
|
1451
|
+
private loadAssets;
|
|
1452
|
+
private assignCanvasKit;
|
|
1453
|
+
private getImagesConfigurationFromGames;
|
|
1454
|
+
prependAssetsUrl(url: string): string;
|
|
1455
|
+
}
|
|
1456
|
+
interface GoToActivityOptions {
|
|
1457
|
+
/** ActivityId of the activity to go to. */
|
|
1458
|
+
id: string;
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Types of values that can be stored in the session dictionary.
|
|
1462
|
+
*/
|
|
1463
|
+
type SessionDictionaryValues = string | number | boolean | object | null | undefined;
|
|
1464
|
+
|
|
1465
|
+
interface Activity {
|
|
1466
|
+
/** The type of activity: Game or Survey */
|
|
1467
|
+
type: ActivityType;
|
|
1468
|
+
/** Initializes the activity. All code to create the activity's appearance and behavior must be placed in this method. This method is asynchronous, and must be awaited. When writing a new game by extending the `Game` class, this method will be overridden, but the base method must still be called with `await super.init()`. */
|
|
1469
|
+
init(): Promise<void>;
|
|
1470
|
+
/** Starts the activity */
|
|
1471
|
+
start(): Promise<void>;
|
|
1472
|
+
/** Stops the activity */
|
|
1473
|
+
stop(): void;
|
|
1474
|
+
/** The activity's parent session */
|
|
1475
|
+
session: Session;
|
|
1476
|
+
/** The activity's unique identifier. NOTE: This is newly generated each session. The uuid for an activity will vary across sessions. */
|
|
1477
|
+
uuid: string;
|
|
1478
|
+
/** Human-friendly name of this activity */
|
|
1479
|
+
name: string;
|
|
1480
|
+
/** Short identifier of this activity */
|
|
1481
|
+
id: string;
|
|
1482
|
+
/** The value of performance.now() immediately before the activity begins */
|
|
1483
|
+
beginTimestamp: number;
|
|
1484
|
+
/** The value of new Date().toISOString() immediately before the activity begins */
|
|
1485
|
+
beginIso8601Timestamp: string;
|
|
1486
|
+
/** Sets additional activity parameters if defaults are not sufficient. */
|
|
1487
|
+
setParameters(additionalParameters: unknown): void;
|
|
1488
|
+
/** Additional activity parameters that were set. */
|
|
1489
|
+
readonly additionalParameters?: unknown;
|
|
1490
|
+
/** Optional store to use for saving data. The implementation of the store is not provided by the \@m2c2kit/core library. */
|
|
1491
|
+
dataStore?: IDataStore;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* Base interface for all m2c2kit events.
|
|
1496
|
+
*
|
|
1497
|
+
* @remarks I would have named it Event, but that would collide with
|
|
1498
|
+
* the existing DOM Event
|
|
1499
|
+
*/
|
|
1500
|
+
interface EventBase {
|
|
1501
|
+
/** Type of event. */
|
|
1502
|
+
type: EventType;
|
|
1503
|
+
/** The object on which the event occurred. */
|
|
1504
|
+
target: Entity | Session | Activity;
|
|
1505
|
+
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
1506
|
+
handled?: boolean;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* The different events that are dispatched by m2c2kit.
|
|
1510
|
+
*/
|
|
1511
|
+
declare enum EventType {
|
|
1512
|
+
SessionInitialize = "SessionInitialize",
|
|
1513
|
+
SessionStart = "SessionStart",
|
|
1514
|
+
SessionEnd = "SessionEnd",
|
|
1515
|
+
ActivityStart = "ActivityStart",
|
|
1516
|
+
ActivityEnd = "ActivityEnd",
|
|
1517
|
+
ActivityCancel = "ActivityCancel",
|
|
1518
|
+
ActivityData = "ActivityData",
|
|
1519
|
+
TapDown = "TapDown",
|
|
1520
|
+
TapUp = "TapUp",
|
|
1521
|
+
TapUpAny = "TapUpAny",
|
|
1522
|
+
TapLeave = "TapLeave",
|
|
1523
|
+
PointerDown = "PointerDown",
|
|
1524
|
+
PointerUp = "PointerUp",
|
|
1525
|
+
PointerMove = "PointerMove",
|
|
1526
|
+
Drag = "Drag",
|
|
1527
|
+
DragStart = "DragStart",
|
|
1528
|
+
DragEnd = "DragEnd",
|
|
1529
|
+
CompositeCustom = "CompositeCustom"
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
interface EntityEventListener {
|
|
1533
|
+
type: EventType;
|
|
1534
|
+
/** For composites that raise events, type of the composite custom event. */
|
|
1535
|
+
compositeType?: string;
|
|
1536
|
+
entityUuid: string;
|
|
1537
|
+
callback: (event: EntityEvent) => void;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Describes an interaction between the pointer (mouse, touches) and an entity.
|
|
1542
|
+
*
|
|
1543
|
+
* @remarks I would have named it PointerEvent, but that would collide with
|
|
1544
|
+
* the existing DOM PointerEvent.
|
|
1545
|
+
*/
|
|
1546
|
+
interface M2PointerEvent extends EntityEvent {
|
|
1547
|
+
/** Point that was tapped on entity, relative to the entity coordinate system */
|
|
1548
|
+
point: Point;
|
|
1549
|
+
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
1550
|
+
buttons: number;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* Describes an interaction of a pointer (mouse, touches) pressing an entity.
|
|
1555
|
+
*
|
|
1556
|
+
* @remarks Unlike M2PointerEvent, TapEvent considers how the pointer, while
|
|
1557
|
+
* in the down state, moves in relation to the bounds of the entity.
|
|
1558
|
+
*/
|
|
1559
|
+
interface TapEvent extends EntityEvent {
|
|
1560
|
+
/** Point that was tapped on entity, relative to the entity coordinate system */
|
|
1561
|
+
point: Point;
|
|
1562
|
+
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
1563
|
+
buttons: number;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
interface TextOptions {
|
|
1567
|
+
/** Text to be displayed */
|
|
1568
|
+
text?: string;
|
|
1569
|
+
/** Name of font to use for text. Must have been previously loaded */
|
|
1570
|
+
fontName?: string;
|
|
1571
|
+
/** Color of text. Default is Constants.DEFAULT_FONT_COLOR (WebColors.Black) */
|
|
1572
|
+
fontColor?: RgbaColor;
|
|
1573
|
+
/** Size of text. Default is Constants.DEFAULT_FONT_SIZE (16) */
|
|
1574
|
+
fontSize?: number;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Width and height on two-dimensional space
|
|
1579
|
+
*/
|
|
1580
|
+
interface Size {
|
|
1581
|
+
/** Horizontal width, x-axis */
|
|
1582
|
+
width: number;
|
|
1583
|
+
/** Vertical height, y-axis */
|
|
1584
|
+
height: number;
|
|
1528
1585
|
}
|
|
1529
1586
|
|
|
1530
1587
|
/**
|
|
@@ -1599,7 +1656,7 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1599
1656
|
*/
|
|
1600
1657
|
toString: () => string;
|
|
1601
1658
|
/**
|
|
1602
|
-
* Adds a child to this parent entity.
|
|
1659
|
+
* Adds a child to this parent entity. Throws exception if the child's name
|
|
1603
1660
|
* is not unique with respect to other children of this parent.
|
|
1604
1661
|
*
|
|
1605
1662
|
* @param child - The child entity to add
|
|
@@ -1871,7 +1928,7 @@ interface MoveActionOptions {
|
|
|
1871
1928
|
duration: number;
|
|
1872
1929
|
/** Easing function for movement; default is linear */
|
|
1873
1930
|
easing?: EasingFunction;
|
|
1874
|
-
/** Should the action run during screen
|
|
1931
|
+
/** Should the action run during screen transitions? Default is no */
|
|
1875
1932
|
runDuringTransition?: boolean;
|
|
1876
1933
|
}
|
|
1877
1934
|
|
|
@@ -2130,7 +2187,7 @@ declare class Constants {
|
|
|
2130
2187
|
}
|
|
2131
2188
|
|
|
2132
2189
|
/**
|
|
2133
|
-
* This enum is used
|
|
2190
|
+
* This enum is used internally for processing the layout constraints. We use
|
|
2134
2191
|
* an enum to avoid magic strings. NOTE: the casing in ConstraintType must
|
|
2135
2192
|
* match the casing in Constraints.ts. Thus, this enum's members are in
|
|
2136
2193
|
* lowercase, which is not typical Typescript style.
|
|
@@ -2169,12 +2226,6 @@ declare class Equals {
|
|
|
2169
2226
|
static rgbaColor(color1?: RgbaColor, color2?: RgbaColor): boolean;
|
|
2170
2227
|
}
|
|
2171
2228
|
|
|
2172
|
-
interface FontData {
|
|
2173
|
-
gameUuid: string;
|
|
2174
|
-
fontUrl: string;
|
|
2175
|
-
fontArrayBuffer: ArrayBuffer;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
2229
|
interface IText {
|
|
2179
2230
|
text?: string;
|
|
2180
2231
|
fontName?: string;
|
|
@@ -2195,6 +2246,8 @@ interface LabelOptions extends EntityOptions, DrawableOptions, TextOptions {
|
|
|
2195
2246
|
preferredMaxLayoutWidth?: number;
|
|
2196
2247
|
/** Background color of label text. Default is no background color */
|
|
2197
2248
|
backgroundColor?: RgbaColor;
|
|
2249
|
+
/** Names of multiple fonts to use for text. For example, if a text font and an emoji font are to be used together. Must have been previously loaded */
|
|
2250
|
+
fontNames?: Array<string>;
|
|
2198
2251
|
}
|
|
2199
2252
|
|
|
2200
2253
|
declare class Label extends Entity implements IDrawable, IText, LabelOptions {
|
|
@@ -2208,6 +2261,7 @@ declare class Label extends Entity implements IDrawable, IText, LabelOptions {
|
|
|
2208
2261
|
zPosition: number;
|
|
2209
2262
|
private _text;
|
|
2210
2263
|
private _fontName;
|
|
2264
|
+
private _fontNames;
|
|
2211
2265
|
private _fontColor;
|
|
2212
2266
|
private _fontSize;
|
|
2213
2267
|
private _horizontalAlignmentMode;
|
|
@@ -2232,6 +2286,8 @@ declare class Label extends Entity implements IDrawable, IText, LabelOptions {
|
|
|
2232
2286
|
get translatedText(): string;
|
|
2233
2287
|
get fontName(): string | undefined;
|
|
2234
2288
|
set fontName(fontName: string | undefined);
|
|
2289
|
+
get fontNames(): Array<string> | undefined;
|
|
2290
|
+
set fontNames(fontNames: Array<string> | undefined);
|
|
2235
2291
|
get fontColor(): RgbaColor;
|
|
2236
2292
|
set fontColor(fontColor: RgbaColor);
|
|
2237
2293
|
get fontSize(): number;
|
|
@@ -2260,7 +2316,7 @@ declare class Label extends Entity implements IDrawable, IText, LabelOptions {
|
|
|
2260
2316
|
|
|
2261
2317
|
/**
|
|
2262
2318
|
* This class is used internally for processing layout constraints that
|
|
2263
|
-
* have been defined according to the
|
|
2319
|
+
* have been defined according to the Constraints interface.
|
|
2264
2320
|
*
|
|
2265
2321
|
* Imagine we have two entities, A and B. B's position is set
|
|
2266
2322
|
* using its position property. A's position is set using the layout
|
|
@@ -2287,7 +2343,7 @@ declare class LayoutConstraint {
|
|
|
2287
2343
|
interface M2Path {
|
|
2288
2344
|
/** The subpath that compose up the path */
|
|
2289
2345
|
subpaths: Array<Array<Point>>;
|
|
2290
|
-
/** The size of the path. This is
|
|
2346
|
+
/** The size of the path. This is needed to properly position the shape that is drawn by the path */
|
|
2291
2347
|
size: Size;
|
|
2292
2348
|
}
|
|
2293
2349
|
|
|
@@ -2406,13 +2462,13 @@ interface ShapeOptions extends EntityOptions, DrawableOptions {
|
|
|
2406
2462
|
fillColor?: RgbaColor;
|
|
2407
2463
|
/** Color with which to outline shape. Default is no color for rectangle and circle, red for path. */
|
|
2408
2464
|
strokeColor?: RgbaColor;
|
|
2409
|
-
/** Width of outline. Default is undefined for rectangle and
|
|
2465
|
+
/** Width of outline. Default is undefined for rectangle and circle, 2 for path. */
|
|
2410
2466
|
lineWidth?: number;
|
|
2411
2467
|
/** A path from which to create the shape */
|
|
2412
2468
|
path?: M2Path | SvgStringPath;
|
|
2413
|
-
/** Size of container "
|
|
2469
|
+
/** Size of container "view box" for path shapes. Leave undefined for circle and rectangle shapes. */
|
|
2414
2470
|
size?: Size;
|
|
2415
|
-
/** Should the shape be drawn with
|
|
2471
|
+
/** Should the shape be drawn with anti-aliasing. Default is yes. */
|
|
2416
2472
|
isAntialiased?: boolean;
|
|
2417
2473
|
}
|
|
2418
2474
|
|
|
@@ -2621,7 +2677,7 @@ declare class Timer {
|
|
|
2621
2677
|
private stopped;
|
|
2622
2678
|
/**
|
|
2623
2679
|
* cumulativeElapsed is a cumulative total of elapsed time while the timer
|
|
2624
|
-
* was in previous started (running) states, NOT INCLUDING the
|
|
2680
|
+
* was in previous started (running) states, NOT INCLUDING the possibly
|
|
2625
2681
|
* active run's duration
|
|
2626
2682
|
*/
|
|
2627
2683
|
private cumulativeElapsed;
|