@m2c2kit/core 0.3.10 → 0.3.12
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/index.d.ts +137 -133
- package/dist/index.js +310 -204
- package/package.json +16 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Scott T. Yabiku
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -19,4 +19,4 @@ This package implements the m2c2kit core functionality.
|
|
|
19
19
|
- [Website](https://m2c2-project.github.io/m2c2kit/)
|
|
20
20
|
- [Live Examples](https://m2c2-project.github.io/m2c2kit/docs/category/examples)
|
|
21
21
|
- [Getting Started](https://m2c2-project.github.io/m2c2kit/docs/getting-started)
|
|
22
|
-
- [Interactive
|
|
22
|
+
- [Interactive Tutorials](https://m2c2-project.github.io/m2c2kit/docs/category/tutorials)
|
package/dist/index.d.ts
CHANGED
|
@@ -720,6 +720,15 @@ interface CallbackOptions {
|
|
|
720
720
|
key?: string;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Notifies when events in the Frame cycle occur on a Game.
|
|
725
|
+
*/
|
|
726
|
+
interface FrameCycleEvent extends EventBase {
|
|
727
|
+
target: Game;
|
|
728
|
+
/** difference in milliseconds since the last Frame lifecycle began */
|
|
729
|
+
deltaTime: number;
|
|
730
|
+
}
|
|
731
|
+
|
|
723
732
|
interface TrialData {
|
|
724
733
|
[key: string]: string | number | boolean | object | undefined | null;
|
|
725
734
|
}
|
|
@@ -742,7 +751,7 @@ declare class Game implements Activity {
|
|
|
742
751
|
i18n?: I18n;
|
|
743
752
|
private warmupFunctionQueue;
|
|
744
753
|
private loaderElementsRemoved;
|
|
745
|
-
private
|
|
754
|
+
private _dataStores?;
|
|
746
755
|
additionalParameters?: unknown;
|
|
747
756
|
staticTrialSchema: {
|
|
748
757
|
[key: string]: JsonSchemaDataTypeScriptTypes;
|
|
@@ -760,12 +769,13 @@ declare class Game implements Activity {
|
|
|
760
769
|
* Saves an item to the activity's key-value store.
|
|
761
770
|
*
|
|
762
771
|
* @remarks The underlying persistence provider of the key-value store must
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
* session
|
|
767
|
-
*
|
|
768
|
-
*
|
|
772
|
+
* have been previously provided in `SessionOptions`.
|
|
773
|
+
* @example
|
|
774
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
775
|
+
* const session = new Session({
|
|
776
|
+
* dataStores: [new LocalDatabase()]
|
|
777
|
+
* ...
|
|
778
|
+
* });
|
|
769
779
|
* @param key - item key
|
|
770
780
|
* @param value - item value
|
|
771
781
|
* @param globalStore - if true, treat the item as "global" and not
|
|
@@ -778,12 +788,13 @@ declare class Game implements Activity {
|
|
|
778
788
|
* Gets an item value from the activity's key-value store.
|
|
779
789
|
*
|
|
780
790
|
* @remarks The underlying persistence provider of the key-value store must
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
* session
|
|
785
|
-
*
|
|
786
|
-
*
|
|
791
|
+
* have been previously provided in `SessionOptions`.
|
|
792
|
+
* @example
|
|
793
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
794
|
+
* const session = new Session({
|
|
795
|
+
* dataStores: [new LocalDatabase()]
|
|
796
|
+
* ...
|
|
797
|
+
* });
|
|
787
798
|
* @param key - item key
|
|
788
799
|
* @param globalStore - if true, treat the item as "global" and not
|
|
789
800
|
* associated with a specific activity; global items can be accessed
|
|
@@ -795,12 +806,13 @@ declare class Game implements Activity {
|
|
|
795
806
|
* Deletes an item value from the activity's key-value store.
|
|
796
807
|
*
|
|
797
808
|
* @remarks The underlying persistence provider of the key-value store must
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
* session
|
|
802
|
-
*
|
|
803
|
-
*
|
|
809
|
+
* have been previously provided in `SessionOptions`.
|
|
810
|
+
* @example
|
|
811
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
812
|
+
* const session = new Session({
|
|
813
|
+
* dataStores: [new LocalDatabase()]
|
|
814
|
+
* ...
|
|
815
|
+
* });
|
|
804
816
|
* @param key - item key
|
|
805
817
|
* @param globalStore - if true, treat the item as "global" and not
|
|
806
818
|
* associated with a specific activity; global items can be accessed
|
|
@@ -811,24 +823,26 @@ declare class Game implements Activity {
|
|
|
811
823
|
* Deletes all items from the activity's key-value store.
|
|
812
824
|
*
|
|
813
825
|
* @remarks The underlying persistence provider of the key-value store must
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
* session
|
|
818
|
-
*
|
|
819
|
-
*
|
|
826
|
+
* have been previously provided in `SessionOptions`.
|
|
827
|
+
* @example
|
|
828
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
829
|
+
* const session = new Session({
|
|
830
|
+
* dataStores: [new LocalDatabase()]
|
|
831
|
+
* ...
|
|
832
|
+
* });
|
|
820
833
|
*/
|
|
821
834
|
storeClearItems(): Promise<void>;
|
|
822
835
|
/**
|
|
823
836
|
* Returns keys of all items in the activity's key-value store.
|
|
824
837
|
*
|
|
825
838
|
* @remarks The underlying persistence provider of the key-value store must
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
829
|
-
* session
|
|
830
|
-
*
|
|
831
|
-
*
|
|
839
|
+
* have been previously provided in `SessionOptions`.
|
|
840
|
+
* @example
|
|
841
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
842
|
+
* const session = new Session({
|
|
843
|
+
* dataStores: [new LocalDatabase()]
|
|
844
|
+
* ...
|
|
845
|
+
* });
|
|
832
846
|
* @param globalStore - if true, treat the item as "global" and not
|
|
833
847
|
* associated with a specific activity; global items can be accessed
|
|
834
848
|
* by any activity. Default is false.
|
|
@@ -838,12 +852,13 @@ declare class Game implements Activity {
|
|
|
838
852
|
* Determines if a key exists in the activity's key-value store.
|
|
839
853
|
*
|
|
840
854
|
* @remarks The underlying persistence provider of the key-value store must
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
*
|
|
844
|
-
* session
|
|
845
|
-
*
|
|
846
|
-
*
|
|
855
|
+
* have been previously provided in `SessionOptions`.
|
|
856
|
+
* @example
|
|
857
|
+
* import { LocalDatabase } from "@m2c2kit/db";
|
|
858
|
+
* const session = new Session({
|
|
859
|
+
* dataStores: [new LocalDatabase()]
|
|
860
|
+
* ...
|
|
861
|
+
* });
|
|
847
862
|
* @param key - item key
|
|
848
863
|
* @param globalStore - if true, treat the item as "global" and not
|
|
849
864
|
* associated with a specific activity; global items can be accessed
|
|
@@ -851,8 +866,8 @@ declare class Game implements Activity {
|
|
|
851
866
|
* @returns true if the key exists, false otherwise
|
|
852
867
|
*/
|
|
853
868
|
storeItemExists(key: string, globalStore?: boolean): Promise<boolean>;
|
|
854
|
-
get
|
|
855
|
-
set
|
|
869
|
+
get dataStores(): IDataStore[];
|
|
870
|
+
set dataStores(dataStores: IDataStore[]);
|
|
856
871
|
private getLocalizationOptionsFromGameParameters;
|
|
857
872
|
private isLocalizationRequested;
|
|
858
873
|
setParameters(additionalParameters: unknown): void;
|
|
@@ -1150,6 +1165,13 @@ declare class Game implements Activity {
|
|
|
1150
1165
|
* @returns - the scene with the screen shot
|
|
1151
1166
|
*/
|
|
1152
1167
|
private createOutgoingScene;
|
|
1168
|
+
/**
|
|
1169
|
+
* Executes a callback when the frame has finished simulating physics.
|
|
1170
|
+
*
|
|
1171
|
+
* @param callback - function to execute.
|
|
1172
|
+
* @param options - options for the callback.
|
|
1173
|
+
*/
|
|
1174
|
+
onFrameDidSimulatePhysics(callback: (frameCycleEvent: FrameCycleEvent) => void, options?: CallbackOptions): void;
|
|
1153
1175
|
private update;
|
|
1154
1176
|
private draw;
|
|
1155
1177
|
private calculateFps;
|
|
@@ -1226,6 +1248,7 @@ declare class Game implements Activity {
|
|
|
1226
1248
|
private raiseTapUpEvent;
|
|
1227
1249
|
private raiseTapUpAny;
|
|
1228
1250
|
private raiseM2PointerMoveEvent;
|
|
1251
|
+
private raiseM2PointerLeaveEvent;
|
|
1229
1252
|
private raiseM2DragStartEvent;
|
|
1230
1253
|
private raiseM2DragEvent;
|
|
1231
1254
|
private raiseM2DragEndEvent;
|
|
@@ -1373,6 +1396,8 @@ interface SessionOptions {
|
|
|
1373
1396
|
sessionUuid?: string;
|
|
1374
1397
|
/** URL of session assets folder (which contains wasm binary), if not the default location of "assets" */
|
|
1375
1398
|
assetsUrl?: string;
|
|
1399
|
+
/** Array of one or more optional databases that implement the IDataStore interface for persisting data. For store item operations, the first data store will be used. */
|
|
1400
|
+
dataStores?: IDataStore[];
|
|
1376
1401
|
/** After the session initializes, should the session automatically start? Default is true */
|
|
1377
1402
|
autoStartAfterInit?: boolean;
|
|
1378
1403
|
/** When an activity ends or is canceled, should the session automatically go to the next activity? Default is true */
|
|
@@ -1389,7 +1414,7 @@ declare class Session {
|
|
|
1389
1414
|
imageManager: ImageManager;
|
|
1390
1415
|
currentActivity?: Activity;
|
|
1391
1416
|
uuid: string;
|
|
1392
|
-
|
|
1417
|
+
dataStores?: IDataStore[];
|
|
1393
1418
|
private eventListeners;
|
|
1394
1419
|
private sessionDictionary;
|
|
1395
1420
|
private canvasKit?;
|
|
@@ -1645,8 +1670,8 @@ interface Activity {
|
|
|
1645
1670
|
setParameters(additionalParameters: unknown): void;
|
|
1646
1671
|
/** Additional activity parameters that were set. */
|
|
1647
1672
|
readonly additionalParameters?: unknown;
|
|
1648
|
-
/** Optional
|
|
1649
|
-
|
|
1673
|
+
/** Optional stores to use for saving data. The implementation of the store is not provided by the \@m2c2kit/core library. */
|
|
1674
|
+
dataStores?: IDataStore[];
|
|
1650
1675
|
}
|
|
1651
1676
|
|
|
1652
1677
|
/**
|
|
@@ -1657,38 +1682,41 @@ interface Activity {
|
|
|
1657
1682
|
*/
|
|
1658
1683
|
interface EventBase {
|
|
1659
1684
|
/** Type of event. */
|
|
1660
|
-
type: EventType;
|
|
1685
|
+
type: EventType | string;
|
|
1661
1686
|
/** The object on which the event occurred. */
|
|
1662
1687
|
target: Entity | Session | Activity;
|
|
1663
1688
|
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
1664
1689
|
handled?: boolean;
|
|
1665
1690
|
}
|
|
1666
1691
|
/**
|
|
1667
|
-
* The different events that are dispatched by m2c2kit.
|
|
1692
|
+
* The different events that are dispatched by m2c2kit core.
|
|
1668
1693
|
*/
|
|
1669
|
-
declare
|
|
1670
|
-
SessionInitialize
|
|
1671
|
-
SessionStart
|
|
1672
|
-
SessionEnd
|
|
1673
|
-
ActivityStart
|
|
1674
|
-
ActivityEnd
|
|
1675
|
-
ActivityCancel
|
|
1676
|
-
ActivityData
|
|
1677
|
-
TapDown
|
|
1678
|
-
TapUp
|
|
1679
|
-
TapUpAny
|
|
1680
|
-
TapLeave
|
|
1681
|
-
PointerDown
|
|
1682
|
-
PointerUp
|
|
1683
|
-
PointerMove
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1694
|
+
declare const EventType: {
|
|
1695
|
+
readonly SessionInitialize: "SessionInitialize";
|
|
1696
|
+
readonly SessionStart: "SessionStart";
|
|
1697
|
+
readonly SessionEnd: "SessionEnd";
|
|
1698
|
+
readonly ActivityStart: "ActivityStart";
|
|
1699
|
+
readonly ActivityEnd: "ActivityEnd";
|
|
1700
|
+
readonly ActivityCancel: "ActivityCancel";
|
|
1701
|
+
readonly ActivityData: "ActivityData";
|
|
1702
|
+
readonly TapDown: "TapDown";
|
|
1703
|
+
readonly TapUp: "TapUp";
|
|
1704
|
+
readonly TapUpAny: "TapUpAny";
|
|
1705
|
+
readonly TapLeave: "TapLeave";
|
|
1706
|
+
readonly PointerDown: "PointerDown";
|
|
1707
|
+
readonly PointerUp: "PointerUp";
|
|
1708
|
+
readonly PointerMove: "PointerMove";
|
|
1709
|
+
readonly PointerLeave: "PointerLeave";
|
|
1710
|
+
readonly Drag: "Drag";
|
|
1711
|
+
readonly DragStart: "DragStart";
|
|
1712
|
+
readonly DragEnd: "DragEnd";
|
|
1713
|
+
readonly CompositeCustom: "CompositeCustom";
|
|
1714
|
+
readonly FrameDidSimulatePhysics: "FrameDidSimulatePhysics";
|
|
1715
|
+
};
|
|
1716
|
+
type EventType = (typeof EventType)[keyof typeof EventType];
|
|
1689
1717
|
|
|
1690
1718
|
interface EntityEventListener {
|
|
1691
|
-
type: EventType;
|
|
1719
|
+
type: EventType | string;
|
|
1692
1720
|
/** For composites that raise events, type of the composite custom event. */
|
|
1693
1721
|
compositeType?: string;
|
|
1694
1722
|
entityUuid: string;
|
|
@@ -1785,6 +1813,7 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1785
1813
|
/** Is the entity in a pressed state? E.g., did the user put the pointer
|
|
1786
1814
|
* down on the entity and not yet release it? */
|
|
1787
1815
|
pressed: boolean;
|
|
1816
|
+
withinHitArea: boolean;
|
|
1788
1817
|
/** Is the entity in a pressed state AND is the pointer within the entity's
|
|
1789
1818
|
* hit area? For example, a user may put the pointer down on the entity, but
|
|
1790
1819
|
* then move the pointer, while still down, beyond the entity's hit area. In
|
|
@@ -1807,6 +1836,12 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1807
1836
|
* @remarks Throws error if entity is not part of the game object.
|
|
1808
1837
|
*/
|
|
1809
1838
|
get game(): Game;
|
|
1839
|
+
/**
|
|
1840
|
+
* Determines if the entity has been added to the game object.
|
|
1841
|
+
*
|
|
1842
|
+
* @returns true if entity has been added
|
|
1843
|
+
*/
|
|
1844
|
+
private isPartOfGame;
|
|
1810
1845
|
/**
|
|
1811
1846
|
* Overrides toString() and returns a human-friendly description of the entity.
|
|
1812
1847
|
*
|
|
@@ -1815,7 +1850,8 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1815
1850
|
toString: () => string;
|
|
1816
1851
|
/**
|
|
1817
1852
|
* Adds a child to this parent entity. Throws exception if the child's name
|
|
1818
|
-
* is not unique with respect to other children of this parent
|
|
1853
|
+
* is not unique with respect to other children of this parent, or if the
|
|
1854
|
+
* child has already been added to another parent.
|
|
1819
1855
|
*
|
|
1820
1856
|
* @param child - The child entity to add
|
|
1821
1857
|
*/
|
|
@@ -1883,13 +1919,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1883
1919
|
* the bounds of the entity.
|
|
1884
1920
|
*
|
|
1885
1921
|
* @param callback - function to execute
|
|
1886
|
-
* @param
|
|
1887
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1888
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1889
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1890
|
-
* special use case. Default is true.
|
|
1922
|
+
* @param options - {@link CallbackOptions}
|
|
1891
1923
|
*/
|
|
1892
|
-
onTapDown(callback: (tapEvent: TapEvent) => void,
|
|
1924
|
+
onTapDown(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1893
1925
|
/**
|
|
1894
1926
|
* Executes a callback when the user releases a press, that has been fully
|
|
1895
1927
|
* within the entity, from the entity.
|
|
@@ -1899,13 +1931,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1899
1931
|
* beyond the bounds of the entity.
|
|
1900
1932
|
*
|
|
1901
1933
|
* @param callback - function to execute
|
|
1902
|
-
* @param
|
|
1903
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1904
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1905
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1906
|
-
* special use case. Default is true.
|
|
1934
|
+
* @param options - {@link CallbackOptions}ue.
|
|
1907
1935
|
*/
|
|
1908
|
-
onTapUp(callback: (tapEvent: TapEvent) => void,
|
|
1936
|
+
onTapUp(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1909
1937
|
/**
|
|
1910
1938
|
* Executes a callback when the user releases a press from the entity within
|
|
1911
1939
|
* the bounds of the entity.
|
|
@@ -1916,13 +1944,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1916
1944
|
* release.
|
|
1917
1945
|
*
|
|
1918
1946
|
* @param callback - function to execute
|
|
1919
|
-
* @param
|
|
1920
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1921
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1922
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1923
|
-
* special use case. Default is true.
|
|
1947
|
+
* @param options - {@link CallbackOptions}
|
|
1924
1948
|
*/
|
|
1925
|
-
onTapUpAny(callback: (tapEvent: TapEvent) => void,
|
|
1949
|
+
onTapUpAny(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1926
1950
|
/**
|
|
1927
1951
|
* Executes a callback when the user moves the pointer (mouse, touches) beyond
|
|
1928
1952
|
* the bounds of the entity while the pointer is down.
|
|
@@ -1932,13 +1956,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1932
1956
|
* before the press release.
|
|
1933
1957
|
*
|
|
1934
1958
|
* @param callback - function to execute
|
|
1935
|
-
* @param
|
|
1936
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1937
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1938
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1939
|
-
* special use case. Default is true.
|
|
1959
|
+
* @param options - {@link CallbackOptions}
|
|
1940
1960
|
*/
|
|
1941
|
-
onTapLeave(callback: (tapEvent: TapEvent) => void,
|
|
1961
|
+
onTapLeave(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1942
1962
|
/**
|
|
1943
1963
|
* Executes a callback when the pointer first is down on the entity.
|
|
1944
1964
|
*
|
|
@@ -1946,13 +1966,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1946
1966
|
* the bounds of the entity. It occurs under the same conditions as TapDown.
|
|
1947
1967
|
*
|
|
1948
1968
|
* @param callback - function to execute
|
|
1949
|
-
* @param
|
|
1950
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1951
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1952
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1953
|
-
* special use case. Default is true.
|
|
1969
|
+
* @param options - {@link CallbackOptions}
|
|
1954
1970
|
*/
|
|
1955
|
-
onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void,
|
|
1971
|
+
onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
1956
1972
|
/**
|
|
1957
1973
|
* Executes a callback when the user releases a press from the entity within
|
|
1958
1974
|
* the bounds of the entity.
|
|
@@ -1962,59 +1978,47 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1962
1978
|
* previous PointerDown on the entity.
|
|
1963
1979
|
*
|
|
1964
1980
|
* @param callback - function to execute
|
|
1965
|
-
* @param
|
|
1966
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1967
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1968
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1969
|
-
* special use case. Default is true.
|
|
1981
|
+
* @param options - {@link CallbackOptions}
|
|
1970
1982
|
*/
|
|
1971
|
-
onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void,
|
|
1983
|
+
onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
1972
1984
|
/**
|
|
1973
1985
|
* Executes a callback when the user moves the pointer (mouse or touches)
|
|
1974
1986
|
* within the bounds of the entity.
|
|
1975
1987
|
*
|
|
1976
1988
|
* @param callback - function to execute
|
|
1977
|
-
* @param
|
|
1978
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1979
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1980
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1981
|
-
* special use case. Default is true.
|
|
1989
|
+
* @param options - {@link CallbackOptions}
|
|
1982
1990
|
*/
|
|
1983
|
-
onPointerMove(callback: (m2PointerEvent: M2PointerEvent) => void,
|
|
1991
|
+
onPointerMove(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
1992
|
+
/**
|
|
1993
|
+
* Executes a callback when the user moves the pointer (mouse or touches)
|
|
1994
|
+
* outside the bounds of the entity.
|
|
1995
|
+
*
|
|
1996
|
+
* @param callback - function to execute
|
|
1997
|
+
* @param options - {@link CallbackOptions}
|
|
1998
|
+
*/
|
|
1999
|
+
onPointerLeave(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
1984
2000
|
/**
|
|
1985
2001
|
* Executes a callback when the user begins dragging an entity.
|
|
1986
2002
|
*
|
|
1987
2003
|
* @param callback - function to execute
|
|
1988
|
-
* @param
|
|
1989
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1990
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1991
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1992
|
-
* special use case. Default is true.
|
|
2004
|
+
* @param options - {@link CallbackOptions}
|
|
1993
2005
|
*/
|
|
1994
|
-
onDragStart(callback: (m2DragEvent: M2DragEvent) => void,
|
|
2006
|
+
onDragStart(callback: (m2DragEvent: M2DragEvent) => void, options?: CallbackOptions): void;
|
|
1995
2007
|
/**
|
|
1996
2008
|
* Executes a callback when the user continues dragging an entity.
|
|
1997
2009
|
*
|
|
1998
2010
|
* @param callback - function to execute
|
|
1999
|
-
* @param
|
|
2000
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
2001
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
2002
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
2003
|
-
* special use case. Default is true.
|
|
2011
|
+
* @param options - {@link CallbackOptions}
|
|
2004
2012
|
*/
|
|
2005
|
-
onDrag(callback: (m2DragEvent: M2DragEvent) => void,
|
|
2013
|
+
onDrag(callback: (m2DragEvent: M2DragEvent) => void, options?: CallbackOptions): void;
|
|
2006
2014
|
/**
|
|
2007
2015
|
* Executes a callback when the user stop dragging an entity.
|
|
2008
2016
|
*
|
|
2009
2017
|
* @param callback - function to execute
|
|
2010
|
-
* @param
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
* special use case. Default is true.
|
|
2015
|
-
*/
|
|
2016
|
-
onDragEnd(callback: (m2DragEvent: M2DragEvent) => void, callbackOptions?: CallbackOptions): void;
|
|
2017
|
-
addEventListener(type: EventType, callback: (ev: EntityEvent) => void, callbackOptions?: CallbackOptions): void;
|
|
2018
|
+
* @param options - {@link CallbackOptions}
|
|
2019
|
+
*/
|
|
2020
|
+
onDragEnd(callback: (m2DragEvent: M2DragEvent) => void, options?: CallbackOptions): void;
|
|
2021
|
+
addEventListener(type: EventType | string, callback: (ev: EntityEvent) => void, callbackOptions?: CallbackOptions): void;
|
|
2018
2022
|
private parseLayoutConstraints;
|
|
2019
2023
|
private calculateYFromConstraint;
|
|
2020
2024
|
private calculateXFromConstraint;
|
|
@@ -2653,7 +2657,6 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2653
2657
|
ckPath: Path | null;
|
|
2654
2658
|
ckPathWidth?: number;
|
|
2655
2659
|
ckPathHeight?: number;
|
|
2656
|
-
pathSvgString?: string;
|
|
2657
2660
|
cornerRadius: number;
|
|
2658
2661
|
private _fillColor;
|
|
2659
2662
|
private _strokeColor?;
|
|
@@ -2668,10 +2671,9 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2668
2671
|
private svgPathScaleForResizing;
|
|
2669
2672
|
private svgPathWidth;
|
|
2670
2673
|
private svgPathHeight;
|
|
2671
|
-
private svgPreviousAbsoluteScale;
|
|
2672
2674
|
private svgPreviousAbsoluteX;
|
|
2673
2675
|
private svgPreviousAbsoluteY;
|
|
2674
|
-
private
|
|
2676
|
+
private svgFirstPathDraw;
|
|
2675
2677
|
/**
|
|
2676
2678
|
* Rectangular, circular, or path-based shape
|
|
2677
2679
|
*
|
|
@@ -2697,9 +2699,11 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2697
2699
|
private drawPathFromSvgString;
|
|
2698
2700
|
private calculateSvgPathY;
|
|
2699
2701
|
private calculateSvgPathX;
|
|
2700
|
-
private
|
|
2702
|
+
private saveSvgPathAbsolutePosition;
|
|
2701
2703
|
private calculateTransformationMatrix;
|
|
2702
2704
|
private pathNeedsTransform;
|
|
2705
|
+
private shapeIsSvgStringPath;
|
|
2706
|
+
private shapeIsM2Path;
|
|
2703
2707
|
private drawCircle;
|
|
2704
2708
|
private drawRectangle;
|
|
2705
2709
|
private drawCircleWithCanvasKit;
|
|
@@ -3100,4 +3104,4 @@ declare class WebGlInfo {
|
|
|
3100
3104
|
static dispose(): void;
|
|
3101
3105
|
}
|
|
3102
3106
|
|
|
3103
|
-
export { Action, Activity, ActivityKeyValueData, ActivityLifecycleEvent, ActivityResultsEvent, ActivityType, BrowserImage, CallbackOptions, CanvasKitHelpers, Composite, CompositeOptions, Constants, ConstraintType, Constraints, CustomAction, CustomActionOptions, DefaultParameter, Dimensions, DrawableOptions, EasingFunction, Easings, Entity, EntityEvent, EntityEventListener, EntityOptions, EntityType, Equals, EventBase, EventListenerBase, EventType, FontData, FontManager, Game, GameData, GameOptions, GameParameters, GlobalVariables, GoToActivityOptions, GroupAction, I18n, IDataStore, IDrawable, IText, ImageManager, Label, LabelHorizontalAlignmentMode, LabelOptions, Layout, LayoutConstraint, LoadedImage, M2DragEvent, M2Path, MoveAction, MoveActionOptions, MutablePath, NoneTransition, Point, RandomDraws, RectOptions, RgbaColor, ScaleAction, ScaleActionOptions, Scene, SceneOptions, SceneTransition, SequenceAction, Session, SessionDictionaryValues, SessionLifecycleEvent, SessionOptions, Shape, ShapeOptions, ShapeType, Size, SlideTransition, SlideTransitionOptions, Sprite, SpriteOptions, Story, StoryOptions, TapEvent, TextLine, TextLineOptions, TextOptions, Timer, Transition, TransitionDirection, TransitionType, Translations, TrialData, TrialSchema, Uuid, WaitAction, WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };
|
|
3107
|
+
export { Action, Activity, ActivityKeyValueData, ActivityLifecycleEvent, ActivityResultsEvent, ActivityType, BrowserImage, CallbackOptions, CanvasKitHelpers, Composite, CompositeOptions, Constants, ConstraintType, Constraints, CustomAction, CustomActionOptions, DefaultParameter, Dimensions, DrawableOptions, EasingFunction, Easings, Entity, EntityEvent, EntityEventListener, EntityOptions, EntityType, Equals, EventBase, EventListenerBase, EventType, FontData, FontManager, Game, GameData, GameOptions, GameParameters, GlobalVariables, GoToActivityOptions, GroupAction, I18n, IDataStore, IDrawable, IText, ImageManager, Label, LabelHorizontalAlignmentMode, LabelOptions, Layout, LayoutConstraint, LoadedImage, M2DragEvent, M2Path, M2PointerEvent, MoveAction, MoveActionOptions, MutablePath, NoneTransition, Point, RandomDraws, RectOptions, RgbaColor, ScaleAction, ScaleActionOptions, Scene, SceneOptions, SceneTransition, SequenceAction, Session, SessionDictionaryValues, SessionLifecycleEvent, SessionOptions, Shape, ShapeOptions, ShapeType, Size, SlideTransition, SlideTransitionOptions, Sprite, SpriteOptions, Story, StoryOptions, TapEvent, TextLine, TextLineOptions, TextOptions, Timer, Transition, TransitionDirection, TransitionType, Translations, TrialData, TrialSchema, Uuid, WaitAction, WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };
|