@m2c2kit/core 0.3.11 → 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/dist/index.d.ts +63 -91
- package/dist/index.js +156 -144
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1248,6 +1248,7 @@ declare class Game implements Activity {
|
|
|
1248
1248
|
private raiseTapUpEvent;
|
|
1249
1249
|
private raiseTapUpAny;
|
|
1250
1250
|
private raiseM2PointerMoveEvent;
|
|
1251
|
+
private raiseM2PointerLeaveEvent;
|
|
1251
1252
|
private raiseM2DragStartEvent;
|
|
1252
1253
|
private raiseM2DragEvent;
|
|
1253
1254
|
private raiseM2DragEndEvent;
|
|
@@ -1681,39 +1682,41 @@ interface Activity {
|
|
|
1681
1682
|
*/
|
|
1682
1683
|
interface EventBase {
|
|
1683
1684
|
/** Type of event. */
|
|
1684
|
-
type: EventType;
|
|
1685
|
+
type: EventType | string;
|
|
1685
1686
|
/** The object on which the event occurred. */
|
|
1686
1687
|
target: Entity | Session | Activity;
|
|
1687
1688
|
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
1688
1689
|
handled?: boolean;
|
|
1689
1690
|
}
|
|
1690
1691
|
/**
|
|
1691
|
-
* The different events that are dispatched by m2c2kit.
|
|
1692
|
+
* The different events that are dispatched by m2c2kit core.
|
|
1692
1693
|
*/
|
|
1693
|
-
declare
|
|
1694
|
-
SessionInitialize
|
|
1695
|
-
SessionStart
|
|
1696
|
-
SessionEnd
|
|
1697
|
-
ActivityStart
|
|
1698
|
-
ActivityEnd
|
|
1699
|
-
ActivityCancel
|
|
1700
|
-
ActivityData
|
|
1701
|
-
TapDown
|
|
1702
|
-
TapUp
|
|
1703
|
-
TapUpAny
|
|
1704
|
-
TapLeave
|
|
1705
|
-
PointerDown
|
|
1706
|
-
PointerUp
|
|
1707
|
-
PointerMove
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
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];
|
|
1714
1717
|
|
|
1715
1718
|
interface EntityEventListener {
|
|
1716
|
-
type: EventType;
|
|
1719
|
+
type: EventType | string;
|
|
1717
1720
|
/** For composites that raise events, type of the composite custom event. */
|
|
1718
1721
|
compositeType?: string;
|
|
1719
1722
|
entityUuid: string;
|
|
@@ -1810,6 +1813,7 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1810
1813
|
/** Is the entity in a pressed state? E.g., did the user put the pointer
|
|
1811
1814
|
* down on the entity and not yet release it? */
|
|
1812
1815
|
pressed: boolean;
|
|
1816
|
+
withinHitArea: boolean;
|
|
1813
1817
|
/** Is the entity in a pressed state AND is the pointer within the entity's
|
|
1814
1818
|
* hit area? For example, a user may put the pointer down on the entity, but
|
|
1815
1819
|
* then move the pointer, while still down, beyond the entity's hit area. In
|
|
@@ -1915,13 +1919,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1915
1919
|
* the bounds of the entity.
|
|
1916
1920
|
*
|
|
1917
1921
|
* @param callback - function to execute
|
|
1918
|
-
* @param
|
|
1919
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1920
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1921
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1922
|
-
* special use case. Default is true.
|
|
1922
|
+
* @param options - {@link CallbackOptions}
|
|
1923
1923
|
*/
|
|
1924
|
-
onTapDown(callback: (tapEvent: TapEvent) => void,
|
|
1924
|
+
onTapDown(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1925
1925
|
/**
|
|
1926
1926
|
* Executes a callback when the user releases a press, that has been fully
|
|
1927
1927
|
* within the entity, from the entity.
|
|
@@ -1931,13 +1931,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1931
1931
|
* beyond the bounds of the entity.
|
|
1932
1932
|
*
|
|
1933
1933
|
* @param callback - function to execute
|
|
1934
|
-
* @param
|
|
1935
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1936
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1937
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1938
|
-
* special use case. Default is true.
|
|
1934
|
+
* @param options - {@link CallbackOptions}ue.
|
|
1939
1935
|
*/
|
|
1940
|
-
onTapUp(callback: (tapEvent: TapEvent) => void,
|
|
1936
|
+
onTapUp(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1941
1937
|
/**
|
|
1942
1938
|
* Executes a callback when the user releases a press from the entity within
|
|
1943
1939
|
* the bounds of the entity.
|
|
@@ -1948,13 +1944,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1948
1944
|
* release.
|
|
1949
1945
|
*
|
|
1950
1946
|
* @param callback - function to execute
|
|
1951
|
-
* @param
|
|
1952
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1953
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1954
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1955
|
-
* special use case. Default is true.
|
|
1947
|
+
* @param options - {@link CallbackOptions}
|
|
1956
1948
|
*/
|
|
1957
|
-
onTapUpAny(callback: (tapEvent: TapEvent) => void,
|
|
1949
|
+
onTapUpAny(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1958
1950
|
/**
|
|
1959
1951
|
* Executes a callback when the user moves the pointer (mouse, touches) beyond
|
|
1960
1952
|
* the bounds of the entity while the pointer is down.
|
|
@@ -1964,13 +1956,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1964
1956
|
* before the press release.
|
|
1965
1957
|
*
|
|
1966
1958
|
* @param callback - function to execute
|
|
1967
|
-
* @param
|
|
1968
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1969
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1970
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1971
|
-
* special use case. Default is true.
|
|
1959
|
+
* @param options - {@link CallbackOptions}
|
|
1972
1960
|
*/
|
|
1973
|
-
onTapLeave(callback: (tapEvent: TapEvent) => void,
|
|
1961
|
+
onTapLeave(callback: (tapEvent: TapEvent) => void, options?: CallbackOptions): void;
|
|
1974
1962
|
/**
|
|
1975
1963
|
* Executes a callback when the pointer first is down on the entity.
|
|
1976
1964
|
*
|
|
@@ -1978,13 +1966,9 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1978
1966
|
* the bounds of the entity. It occurs under the same conditions as TapDown.
|
|
1979
1967
|
*
|
|
1980
1968
|
* @param callback - function to execute
|
|
1981
|
-
* @param
|
|
1982
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1983
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1984
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1985
|
-
* special use case. Default is true.
|
|
1969
|
+
* @param options - {@link CallbackOptions}
|
|
1986
1970
|
*/
|
|
1987
|
-
onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void,
|
|
1971
|
+
onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
1988
1972
|
/**
|
|
1989
1973
|
* Executes a callback when the user releases a press from the entity within
|
|
1990
1974
|
* the bounds of the entity.
|
|
@@ -1994,59 +1978,47 @@ declare abstract class Entity implements EntityOptions {
|
|
|
1994
1978
|
* previous PointerDown on the entity.
|
|
1995
1979
|
*
|
|
1996
1980
|
* @param callback - function to execute
|
|
1997
|
-
* @param
|
|
1998
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1999
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
2000
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
2001
|
-
* special use case. Default is true.
|
|
1981
|
+
* @param options - {@link CallbackOptions}
|
|
2002
1982
|
*/
|
|
2003
|
-
onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void,
|
|
1983
|
+
onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void, options?: CallbackOptions): void;
|
|
2004
1984
|
/**
|
|
2005
1985
|
* Executes a callback when the user moves the pointer (mouse or touches)
|
|
2006
1986
|
* within the bounds of the entity.
|
|
2007
1987
|
*
|
|
2008
1988
|
* @param callback - function to execute
|
|
2009
|
-
* @param
|
|
2010
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
2011
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
2012
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
2013
|
-
* special use case. Default is true.
|
|
1989
|
+
* @param options - {@link CallbackOptions}
|
|
2014
1990
|
*/
|
|
2015
|
-
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;
|
|
2016
2000
|
/**
|
|
2017
2001
|
* Executes a callback when the user begins dragging an entity.
|
|
2018
2002
|
*
|
|
2019
2003
|
* @param callback - function to execute
|
|
2020
|
-
* @param
|
|
2021
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
2022
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
2023
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
2024
|
-
* special use case. Default is true.
|
|
2004
|
+
* @param options - {@link CallbackOptions}
|
|
2025
2005
|
*/
|
|
2026
|
-
onDragStart(callback: (m2DragEvent: M2DragEvent) => void,
|
|
2006
|
+
onDragStart(callback: (m2DragEvent: M2DragEvent) => void, options?: CallbackOptions): void;
|
|
2027
2007
|
/**
|
|
2028
2008
|
* Executes a callback when the user continues dragging an entity.
|
|
2029
2009
|
*
|
|
2030
2010
|
* @param callback - function to execute
|
|
2031
|
-
* @param
|
|
2032
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
2033
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
2034
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
2035
|
-
* special use case. Default is true.
|
|
2011
|
+
* @param options - {@link CallbackOptions}
|
|
2036
2012
|
*/
|
|
2037
|
-
onDrag(callback: (m2DragEvent: M2DragEvent) => void,
|
|
2013
|
+
onDrag(callback: (m2DragEvent: M2DragEvent) => void, options?: CallbackOptions): void;
|
|
2038
2014
|
/**
|
|
2039
2015
|
* Executes a callback when the user stop dragging an entity.
|
|
2040
2016
|
*
|
|
2041
2017
|
* @param callback - function to execute
|
|
2042
|
-
* @param
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
* special use case. Default is true.
|
|
2047
|
-
*/
|
|
2048
|
-
onDragEnd(callback: (m2DragEvent: M2DragEvent) => void, callbackOptions?: CallbackOptions): void;
|
|
2049
|
-
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;
|
|
2050
2022
|
private parseLayoutConstraints;
|
|
2051
2023
|
private calculateYFromConstraint;
|
|
2052
2024
|
private calculateXFromConstraint;
|
|
@@ -2685,7 +2657,6 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2685
2657
|
ckPath: Path | null;
|
|
2686
2658
|
ckPathWidth?: number;
|
|
2687
2659
|
ckPathHeight?: number;
|
|
2688
|
-
pathSvgString?: string;
|
|
2689
2660
|
cornerRadius: number;
|
|
2690
2661
|
private _fillColor;
|
|
2691
2662
|
private _strokeColor?;
|
|
@@ -2700,10 +2671,9 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2700
2671
|
private svgPathScaleForResizing;
|
|
2701
2672
|
private svgPathWidth;
|
|
2702
2673
|
private svgPathHeight;
|
|
2703
|
-
private svgPreviousAbsoluteScale;
|
|
2704
2674
|
private svgPreviousAbsoluteX;
|
|
2705
2675
|
private svgPreviousAbsoluteY;
|
|
2706
|
-
private
|
|
2676
|
+
private svgFirstPathDraw;
|
|
2707
2677
|
/**
|
|
2708
2678
|
* Rectangular, circular, or path-based shape
|
|
2709
2679
|
*
|
|
@@ -2729,9 +2699,11 @@ declare class Shape extends Entity implements IDrawable, ShapeOptions {
|
|
|
2729
2699
|
private drawPathFromSvgString;
|
|
2730
2700
|
private calculateSvgPathY;
|
|
2731
2701
|
private calculateSvgPathX;
|
|
2732
|
-
private
|
|
2702
|
+
private saveSvgPathAbsolutePosition;
|
|
2733
2703
|
private calculateTransformationMatrix;
|
|
2734
2704
|
private pathNeedsTransform;
|
|
2705
|
+
private shapeIsSvgStringPath;
|
|
2706
|
+
private shapeIsM2Path;
|
|
2735
2707
|
private drawCircle;
|
|
2736
2708
|
private drawRectangle;
|
|
2737
2709
|
private drawCircleWithCanvasKit;
|
|
@@ -3132,4 +3104,4 @@ declare class WebGlInfo {
|
|
|
3132
3104
|
static dispose(): void;
|
|
3133
3105
|
}
|
|
3134
3106
|
|
|
3135
|
-
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 };
|
package/dist/index.js
CHANGED
|
@@ -749,28 +749,28 @@ class Uuid {
|
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
752
|
+
const EventType = {
|
|
753
|
+
SessionInitialize: "SessionInitialize",
|
|
754
|
+
SessionStart: "SessionStart",
|
|
755
|
+
SessionEnd: "SessionEnd",
|
|
756
|
+
ActivityStart: "ActivityStart",
|
|
757
|
+
ActivityEnd: "ActivityEnd",
|
|
758
|
+
ActivityCancel: "ActivityCancel",
|
|
759
|
+
ActivityData: "ActivityData",
|
|
760
|
+
TapDown: "TapDown",
|
|
761
|
+
TapUp: "TapUp",
|
|
762
|
+
TapUpAny: "TapUpAny",
|
|
763
|
+
TapLeave: "TapLeave",
|
|
764
|
+
PointerDown: "PointerDown",
|
|
765
|
+
PointerUp: "PointerUp",
|
|
766
|
+
PointerMove: "PointerMove",
|
|
767
|
+
PointerLeave: "PointerLeave",
|
|
768
|
+
Drag: "Drag",
|
|
769
|
+
DragStart: "DragStart",
|
|
770
|
+
DragEnd: "DragEnd",
|
|
771
|
+
CompositeCustom: "CompositeCustom",
|
|
772
|
+
FrameDidSimulatePhysics: "FrameDidSimulatePhysics"
|
|
773
|
+
};
|
|
774
774
|
|
|
775
775
|
var __defProp$g = Object.defineProperty;
|
|
776
776
|
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -846,6 +846,7 @@ class Entity {
|
|
|
846
846
|
/** Is the entity in a pressed state? E.g., did the user put the pointer
|
|
847
847
|
* down on the entity and not yet release it? */
|
|
848
848
|
__publicField$g(this, "pressed", false);
|
|
849
|
+
__publicField$g(this, "withinHitArea", false);
|
|
849
850
|
/** Is the entity in a pressed state AND is the pointer within the entity's
|
|
850
851
|
* hit area? For example, a user may put the pointer down on the entity, but
|
|
851
852
|
* then move the pointer, while still down, beyond the entity's hit area. In
|
|
@@ -1130,17 +1131,13 @@ class Entity {
|
|
|
1130
1131
|
* the bounds of the entity.
|
|
1131
1132
|
*
|
|
1132
1133
|
* @param callback - function to execute
|
|
1133
|
-
* @param
|
|
1134
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1135
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1136
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1137
|
-
* special use case. Default is true.
|
|
1134
|
+
* @param options - {@link CallbackOptions}
|
|
1138
1135
|
*/
|
|
1139
|
-
onTapDown(callback,
|
|
1136
|
+
onTapDown(callback, options) {
|
|
1140
1137
|
this.addEventListener(
|
|
1141
1138
|
EventType.TapDown,
|
|
1142
1139
|
callback,
|
|
1143
|
-
|
|
1140
|
+
options
|
|
1144
1141
|
);
|
|
1145
1142
|
}
|
|
1146
1143
|
/**
|
|
@@ -1152,17 +1149,13 @@ class Entity {
|
|
|
1152
1149
|
* beyond the bounds of the entity.
|
|
1153
1150
|
*
|
|
1154
1151
|
* @param callback - function to execute
|
|
1155
|
-
* @param
|
|
1156
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1157
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1158
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1159
|
-
* special use case. Default is true.
|
|
1152
|
+
* @param options - {@link CallbackOptions}ue.
|
|
1160
1153
|
*/
|
|
1161
|
-
onTapUp(callback,
|
|
1154
|
+
onTapUp(callback, options) {
|
|
1162
1155
|
this.addEventListener(
|
|
1163
1156
|
EventType.TapUp,
|
|
1164
1157
|
callback,
|
|
1165
|
-
|
|
1158
|
+
options
|
|
1166
1159
|
);
|
|
1167
1160
|
}
|
|
1168
1161
|
/**
|
|
@@ -1175,17 +1168,13 @@ class Entity {
|
|
|
1175
1168
|
* release.
|
|
1176
1169
|
*
|
|
1177
1170
|
* @param callback - function to execute
|
|
1178
|
-
* @param
|
|
1179
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1180
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1181
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1182
|
-
* special use case. Default is true.
|
|
1171
|
+
* @param options - {@link CallbackOptions}
|
|
1183
1172
|
*/
|
|
1184
|
-
onTapUpAny(callback,
|
|
1173
|
+
onTapUpAny(callback, options) {
|
|
1185
1174
|
this.addEventListener(
|
|
1186
1175
|
EventType.TapUpAny,
|
|
1187
1176
|
callback,
|
|
1188
|
-
|
|
1177
|
+
options
|
|
1189
1178
|
);
|
|
1190
1179
|
}
|
|
1191
1180
|
/**
|
|
@@ -1197,17 +1186,13 @@ class Entity {
|
|
|
1197
1186
|
* before the press release.
|
|
1198
1187
|
*
|
|
1199
1188
|
* @param callback - function to execute
|
|
1200
|
-
* @param
|
|
1201
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1202
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1203
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1204
|
-
* special use case. Default is true.
|
|
1189
|
+
* @param options - {@link CallbackOptions}
|
|
1205
1190
|
*/
|
|
1206
|
-
onTapLeave(callback,
|
|
1191
|
+
onTapLeave(callback, options) {
|
|
1207
1192
|
this.addEventListener(
|
|
1208
1193
|
EventType.TapLeave,
|
|
1209
1194
|
callback,
|
|
1210
|
-
|
|
1195
|
+
options
|
|
1211
1196
|
);
|
|
1212
1197
|
}
|
|
1213
1198
|
/**
|
|
@@ -1217,17 +1202,13 @@ class Entity {
|
|
|
1217
1202
|
* the bounds of the entity. It occurs under the same conditions as TapDown.
|
|
1218
1203
|
*
|
|
1219
1204
|
* @param callback - function to execute
|
|
1220
|
-
* @param
|
|
1221
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1222
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1223
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1224
|
-
* special use case. Default is true.
|
|
1205
|
+
* @param options - {@link CallbackOptions}
|
|
1225
1206
|
*/
|
|
1226
|
-
onPointerDown(callback,
|
|
1207
|
+
onPointerDown(callback, options) {
|
|
1227
1208
|
this.addEventListener(
|
|
1228
1209
|
EventType.PointerDown,
|
|
1229
1210
|
callback,
|
|
1230
|
-
|
|
1211
|
+
options
|
|
1231
1212
|
);
|
|
1232
1213
|
}
|
|
1233
1214
|
/**
|
|
@@ -1239,17 +1220,13 @@ class Entity {
|
|
|
1239
1220
|
* previous PointerDown on the entity.
|
|
1240
1221
|
*
|
|
1241
1222
|
* @param callback - function to execute
|
|
1242
|
-
* @param
|
|
1243
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1244
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1245
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1246
|
-
* special use case. Default is true.
|
|
1223
|
+
* @param options - {@link CallbackOptions}
|
|
1247
1224
|
*/
|
|
1248
|
-
onPointerUp(callback,
|
|
1225
|
+
onPointerUp(callback, options) {
|
|
1249
1226
|
this.addEventListener(
|
|
1250
1227
|
EventType.PointerUp,
|
|
1251
1228
|
callback,
|
|
1252
|
-
|
|
1229
|
+
options
|
|
1253
1230
|
);
|
|
1254
1231
|
}
|
|
1255
1232
|
/**
|
|
@@ -1257,68 +1234,66 @@ class Entity {
|
|
|
1257
1234
|
* within the bounds of the entity.
|
|
1258
1235
|
*
|
|
1259
1236
|
* @param callback - function to execute
|
|
1260
|
-
* @param
|
|
1261
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1262
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1263
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1264
|
-
* special use case. Default is true.
|
|
1237
|
+
* @param options - {@link CallbackOptions}
|
|
1265
1238
|
*/
|
|
1266
|
-
onPointerMove(callback,
|
|
1239
|
+
onPointerMove(callback, options) {
|
|
1267
1240
|
this.addEventListener(
|
|
1268
1241
|
EventType.PointerMove,
|
|
1269
1242
|
callback,
|
|
1270
|
-
|
|
1243
|
+
options
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Executes a callback when the user moves the pointer (mouse or touches)
|
|
1248
|
+
* outside the bounds of the entity.
|
|
1249
|
+
*
|
|
1250
|
+
* @param callback - function to execute
|
|
1251
|
+
* @param options - {@link CallbackOptions}
|
|
1252
|
+
*/
|
|
1253
|
+
onPointerLeave(callback, options) {
|
|
1254
|
+
this.addEventListener(
|
|
1255
|
+
EventType.PointerLeave,
|
|
1256
|
+
callback,
|
|
1257
|
+
options
|
|
1271
1258
|
);
|
|
1272
1259
|
}
|
|
1273
1260
|
/**
|
|
1274
1261
|
* Executes a callback when the user begins dragging an entity.
|
|
1275
1262
|
*
|
|
1276
1263
|
* @param callback - function to execute
|
|
1277
|
-
* @param
|
|
1278
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1279
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1280
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1281
|
-
* special use case. Default is true.
|
|
1264
|
+
* @param options - {@link CallbackOptions}
|
|
1282
1265
|
*/
|
|
1283
|
-
onDragStart(callback,
|
|
1266
|
+
onDragStart(callback, options) {
|
|
1284
1267
|
this.addEventListener(
|
|
1285
1268
|
EventType.DragStart,
|
|
1286
1269
|
callback,
|
|
1287
|
-
|
|
1270
|
+
options
|
|
1288
1271
|
);
|
|
1289
1272
|
}
|
|
1290
1273
|
/**
|
|
1291
1274
|
* Executes a callback when the user continues dragging an entity.
|
|
1292
1275
|
*
|
|
1293
1276
|
* @param callback - function to execute
|
|
1294
|
-
* @param
|
|
1295
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1296
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1297
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1298
|
-
* special use case. Default is true.
|
|
1277
|
+
* @param options - {@link CallbackOptions}
|
|
1299
1278
|
*/
|
|
1300
|
-
onDrag(callback,
|
|
1279
|
+
onDrag(callback, options) {
|
|
1301
1280
|
this.addEventListener(
|
|
1302
1281
|
EventType.Drag,
|
|
1303
1282
|
callback,
|
|
1304
|
-
|
|
1283
|
+
options
|
|
1305
1284
|
);
|
|
1306
1285
|
}
|
|
1307
1286
|
/**
|
|
1308
1287
|
* Executes a callback when the user stop dragging an entity.
|
|
1309
1288
|
*
|
|
1310
1289
|
* @param callback - function to execute
|
|
1311
|
-
* @param
|
|
1312
|
-
* any existing callbacks of the same event type on this entity? Usually
|
|
1313
|
-
* there should be only one callback defined, instead of chaining multiple
|
|
1314
|
-
* ones. It is strongly recommended not to change this, unless you have a
|
|
1315
|
-
* special use case. Default is true.
|
|
1290
|
+
* @param options - {@link CallbackOptions}
|
|
1316
1291
|
*/
|
|
1317
|
-
onDragEnd(callback,
|
|
1292
|
+
onDragEnd(callback, options) {
|
|
1318
1293
|
this.addEventListener(
|
|
1319
1294
|
EventType.DragEnd,
|
|
1320
1295
|
callback,
|
|
1321
|
-
|
|
1296
|
+
options
|
|
1322
1297
|
);
|
|
1323
1298
|
}
|
|
1324
1299
|
addEventListener(type, callback, callbackOptions) {
|
|
@@ -5338,6 +5313,17 @@ class Game {
|
|
|
5338
5313
|
domPointerEvent.offsetY
|
|
5339
5314
|
)) {
|
|
5340
5315
|
this.raiseM2PointerMoveEvent(entity, m2Event, domPointerEvent);
|
|
5316
|
+
entity.withinHitArea = true;
|
|
5317
|
+
}
|
|
5318
|
+
if (!this.IsCanvasPointWithinEntityBounds(
|
|
5319
|
+
entity,
|
|
5320
|
+
domPointerEvent.offsetX,
|
|
5321
|
+
domPointerEvent.offsetY
|
|
5322
|
+
)) {
|
|
5323
|
+
if (entity.withinHitArea) {
|
|
5324
|
+
this.raiseM2PointerLeaveEvent(entity, m2Event, domPointerEvent);
|
|
5325
|
+
entity.withinHitArea = false;
|
|
5326
|
+
}
|
|
5341
5327
|
}
|
|
5342
5328
|
if (entity.children) {
|
|
5343
5329
|
entity.children.filter((entity2) => !entity2.hidden).filter((entity2) => entity2.isDrawable).sort(
|
|
@@ -5410,6 +5396,15 @@ class Game {
|
|
|
5410
5396
|
domPointerEvent
|
|
5411
5397
|
);
|
|
5412
5398
|
}
|
|
5399
|
+
raiseM2PointerLeaveEvent(entity, m2Event, domPointerEvent) {
|
|
5400
|
+
m2Event.target = entity;
|
|
5401
|
+
m2Event.type = EventType.PointerLeave;
|
|
5402
|
+
this.raiseEventOnListeningEntities(
|
|
5403
|
+
entity,
|
|
5404
|
+
m2Event,
|
|
5405
|
+
domPointerEvent
|
|
5406
|
+
);
|
|
5407
|
+
}
|
|
5413
5408
|
raiseM2DragStartEvent(entity, m2Event, domPointerEvent) {
|
|
5414
5409
|
m2Event.target = entity;
|
|
5415
5410
|
m2Event.type = EventType.DragStart;
|
|
@@ -5524,6 +5519,7 @@ class Game {
|
|
|
5524
5519
|
case EventType.PointerDown:
|
|
5525
5520
|
case EventType.PointerMove:
|
|
5526
5521
|
case EventType.PointerUp:
|
|
5522
|
+
case EventType.PointerLeave:
|
|
5527
5523
|
m2Event.point = this.calculatePointWithinEntityFromDomPointerEvent(
|
|
5528
5524
|
entity,
|
|
5529
5525
|
domEvent
|
|
@@ -5582,11 +5578,14 @@ class Game {
|
|
|
5582
5578
|
if (!radius) {
|
|
5583
5579
|
throw "circleOfRadius is undefined";
|
|
5584
5580
|
}
|
|
5585
|
-
const center = {
|
|
5581
|
+
const center = {
|
|
5582
|
+
x: bb2.xMin + radius * entity.absoluteScale,
|
|
5583
|
+
y: bb2.yMin + radius * entity.absoluteScale
|
|
5584
|
+
};
|
|
5586
5585
|
const distance = Math.sqrt(
|
|
5587
5586
|
Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)
|
|
5588
5587
|
);
|
|
5589
|
-
return distance <= radius;
|
|
5588
|
+
return distance <= radius * entity.absoluteScale;
|
|
5590
5589
|
}
|
|
5591
5590
|
if (entity.size.width === 0 || entity.size.height === 0) {
|
|
5592
5591
|
return false;
|
|
@@ -7104,7 +7103,7 @@ class Session {
|
|
|
7104
7103
|
__publicField$2(this, "sessionDictionary", /* @__PURE__ */ new Map());
|
|
7105
7104
|
__publicField$2(this, "canvasKit");
|
|
7106
7105
|
__publicField$2(this, "initialized", false);
|
|
7107
|
-
__publicField$2(this, "version", "0.3.
|
|
7106
|
+
__publicField$2(this, "version", "0.3.12 (291d0cee)");
|
|
7108
7107
|
this.options = options;
|
|
7109
7108
|
for (const activity of this.options.activities) {
|
|
7110
7109
|
if (this.options.activities.filter((a) => a === activity).length > 1) {
|
|
@@ -7621,7 +7620,6 @@ class Shape extends Entity {
|
|
|
7621
7620
|
* @param options - {@link ShapeOptions}
|
|
7622
7621
|
*/
|
|
7623
7622
|
constructor(options = {}) {
|
|
7624
|
-
var _a;
|
|
7625
7623
|
super(options);
|
|
7626
7624
|
__publicField$1(this, "type", EntityType.Shape);
|
|
7627
7625
|
__publicField$1(this, "isDrawable", true);
|
|
@@ -7638,7 +7636,6 @@ class Shape extends Entity {
|
|
|
7638
7636
|
__publicField$1(this, "ckPath", null);
|
|
7639
7637
|
__publicField$1(this, "ckPathWidth");
|
|
7640
7638
|
__publicField$1(this, "ckPathHeight");
|
|
7641
|
-
__publicField$1(this, "pathSvgString");
|
|
7642
7639
|
__publicField$1(this, "cornerRadius", 0);
|
|
7643
7640
|
__publicField$1(this, "_fillColor", Constants.DEFAULT_SHAPE_FILL_COLOR);
|
|
7644
7641
|
__publicField$1(this, "_strokeColor");
|
|
@@ -7653,15 +7650,17 @@ class Shape extends Entity {
|
|
|
7653
7650
|
__publicField$1(this, "svgPathScaleForResizing", 1);
|
|
7654
7651
|
__publicField$1(this, "svgPathWidth", 0);
|
|
7655
7652
|
__publicField$1(this, "svgPathHeight", 0);
|
|
7656
|
-
__publicField$1(this, "svgPreviousAbsoluteScale", NaN);
|
|
7657
7653
|
__publicField$1(this, "svgPreviousAbsoluteX", NaN);
|
|
7658
7654
|
__publicField$1(this, "svgPreviousAbsoluteY", NaN);
|
|
7659
|
-
__publicField$1(this, "
|
|
7655
|
+
__publicField$1(this, "svgFirstPathDraw", true);
|
|
7660
7656
|
handleInterfaceOptions(this, options);
|
|
7661
|
-
if (
|
|
7657
|
+
if (options.path !== void 0) {
|
|
7658
|
+
this.path = options.path;
|
|
7662
7659
|
this.shapeType = ShapeType.Path;
|
|
7663
|
-
this.
|
|
7664
|
-
|
|
7660
|
+
if (this.path.size !== void 0) {
|
|
7661
|
+
this.size.height = this.path.size.height;
|
|
7662
|
+
this.size.width = this.path.size.width;
|
|
7663
|
+
}
|
|
7665
7664
|
this.svgPathRequestedWidth = options.path.width;
|
|
7666
7665
|
this.svgPathRequestedHeight = options.path.height;
|
|
7667
7666
|
if (this.svgPathRequestedHeight !== void 0 && this.svgPathRequestedWidth !== void 0) {
|
|
@@ -7739,28 +7738,29 @@ class Shape extends Entity {
|
|
|
7739
7738
|
}
|
|
7740
7739
|
}
|
|
7741
7740
|
initialize() {
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7741
|
+
if (this.shapeType === ShapeType.Path) {
|
|
7742
|
+
if (this.shapeIsSvgStringPath()) {
|
|
7743
|
+
const pathSvgString = this.path.svgPathString;
|
|
7744
|
+
if (!pathSvgString) {
|
|
7745
|
+
throw new Error("SVG Path string is null/undefined");
|
|
7746
|
+
}
|
|
7747
|
+
this.ckPath = this.canvasKit.Path.MakeFromSVGString(pathSvgString);
|
|
7748
|
+
if (!this.ckPath) {
|
|
7749
|
+
throw new Error("could not make CanvasKit Path from SVG string");
|
|
7750
|
+
}
|
|
7751
|
+
const bounds = this.ckPath.getBounds();
|
|
7752
|
+
this.svgPathWidth = bounds[2] + (bounds[0] < 0 ? Math.abs(bounds[0]) : 0);
|
|
7753
|
+
this.svgPathHeight = bounds[3] + (bounds[1] < 0 ? Math.abs(bounds[1]) : 0);
|
|
7754
|
+
if (this.svgPathRequestedHeight !== void 0) {
|
|
7755
|
+
this.svgPathScaleForResizing = this.svgPathRequestedHeight / this.svgPathHeight;
|
|
7756
|
+
} else if (this.svgPathRequestedWidth !== void 0) {
|
|
7757
|
+
this.svgPathScaleForResizing = this.svgPathRequestedWidth / this.svgPathWidth;
|
|
7758
|
+
}
|
|
7759
|
+
this.size.width = this.svgPathWidth * this.svgPathScaleForResizing;
|
|
7760
|
+
this.size.height = this.svgPathHeight * this.svgPathScaleForResizing;
|
|
7761
|
+
this.svgPreviousAbsoluteX = 0;
|
|
7762
|
+
this.svgPreviousAbsoluteY = 0;
|
|
7763
|
+
}
|
|
7764
7764
|
}
|
|
7765
7765
|
if (this.fillColor) {
|
|
7766
7766
|
this.fillColorPaintAntialiased = CanvasKitHelpers.makePaint(
|
|
@@ -7790,6 +7790,7 @@ class Shape extends Entity {
|
|
|
7790
7790
|
false
|
|
7791
7791
|
);
|
|
7792
7792
|
}
|
|
7793
|
+
this.svgFirstPathDraw = true;
|
|
7793
7794
|
this.needsInitialization = false;
|
|
7794
7795
|
}
|
|
7795
7796
|
dispose() {
|
|
@@ -7838,10 +7839,10 @@ class Shape extends Entity {
|
|
|
7838
7839
|
canvas.save();
|
|
7839
7840
|
const drawScale = Globals.canvasScale / this.absoluteScale;
|
|
7840
7841
|
canvas.scale(1 / drawScale, 1 / drawScale);
|
|
7841
|
-
if (this.
|
|
7842
|
+
if (this.shapeIsM2Path()) {
|
|
7842
7843
|
this.drawPathFromM2Path(canvas);
|
|
7843
7844
|
}
|
|
7844
|
-
if (this.
|
|
7845
|
+
if (this.shapeIsSvgStringPath()) {
|
|
7845
7846
|
this.drawPathFromSvgString(canvas);
|
|
7846
7847
|
}
|
|
7847
7848
|
if (this.shapeType === ShapeType.Circle) {
|
|
@@ -7858,18 +7859,16 @@ class Shape extends Entity {
|
|
|
7858
7859
|
const pathOriginX = (this.absolutePosition.x - this.anchorPoint.x * this.size.width * this.absoluteScale) * drawScale;
|
|
7859
7860
|
const pathOriginY = (this.absolutePosition.y - this.anchorPoint.y * this.size.height * this.absoluteScale) * drawScale;
|
|
7860
7861
|
if (this.strokeColor && this.strokeColorPaintAntialiased && this.lineWidth) {
|
|
7861
|
-
this.strokeColorPaintAntialiased.setStrokeWidth(
|
|
7862
|
-
this.lineWidth * drawScale
|
|
7863
|
-
);
|
|
7862
|
+
this.strokeColorPaintAntialiased.setStrokeWidth(this.lineWidth);
|
|
7864
7863
|
const subpaths = this.path.subpaths;
|
|
7865
7864
|
for (const subpath of subpaths) {
|
|
7866
7865
|
const points = subpath.flat();
|
|
7867
7866
|
for (let i = 0; i < points.length - 1; i++) {
|
|
7868
7867
|
canvas.drawLine(
|
|
7869
|
-
pathOriginX + points[i].x *
|
|
7870
|
-
pathOriginY + points[i].y *
|
|
7871
|
-
pathOriginX + points[i + 1].x *
|
|
7872
|
-
pathOriginY + points[i + 1].y *
|
|
7868
|
+
pathOriginX + points[i].x * Globals.canvasScale,
|
|
7869
|
+
pathOriginY + points[i].y * Globals.canvasScale,
|
|
7870
|
+
pathOriginX + points[i + 1].x * Globals.canvasScale,
|
|
7871
|
+
pathOriginY + points[i + 1].y * Globals.canvasScale,
|
|
7873
7872
|
this.strokeColorPaintAntialiased
|
|
7874
7873
|
);
|
|
7875
7874
|
}
|
|
@@ -7882,12 +7881,12 @@ class Shape extends Entity {
|
|
|
7882
7881
|
}
|
|
7883
7882
|
const x = this.calculateSvgPathX();
|
|
7884
7883
|
const y = this.calculateSvgPathY();
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7884
|
+
if (this.pathNeedsTransform(x, y)) {
|
|
7885
|
+
const drawScale = Globals.canvasScale / this.absoluteScale;
|
|
7886
|
+
const pathScale = drawScale * this.svgPathScaleForResizing * Globals.rootScale;
|
|
7888
7887
|
const matrix = this.calculateTransformationMatrix(pathScale, x, y);
|
|
7889
7888
|
this.ckPath = this.ckPath.transform(matrix);
|
|
7890
|
-
this.
|
|
7889
|
+
this.saveSvgPathAbsolutePosition(x, y);
|
|
7891
7890
|
}
|
|
7892
7891
|
if (this.fillColor) {
|
|
7893
7892
|
const paint = this.getFillPaint();
|
|
@@ -7900,25 +7899,38 @@ class Shape extends Entity {
|
|
|
7900
7899
|
}
|
|
7901
7900
|
calculateSvgPathY() {
|
|
7902
7901
|
const drawScale = Globals.canvasScale / this.absoluteScale;
|
|
7903
|
-
return (this.absolutePosition.y
|
|
7902
|
+
return (this.absolutePosition.y - this.size.height * this.absoluteScale / 2) * drawScale;
|
|
7904
7903
|
}
|
|
7905
7904
|
calculateSvgPathX() {
|
|
7906
7905
|
const drawScale = Globals.canvasScale / this.absoluteScale;
|
|
7907
|
-
return (this.absolutePosition.x
|
|
7906
|
+
return (this.absolutePosition.x - this.size.width * this.absoluteScale / 2) * drawScale;
|
|
7908
7907
|
}
|
|
7909
|
-
|
|
7910
|
-
this.svgPreviousAbsoluteScale = pathScale;
|
|
7908
|
+
saveSvgPathAbsolutePosition(x, y) {
|
|
7911
7909
|
this.svgPreviousAbsoluteX = x;
|
|
7912
7910
|
this.svgPreviousAbsoluteY = y;
|
|
7913
7911
|
}
|
|
7914
7912
|
calculateTransformationMatrix(pathScale, x, y) {
|
|
7915
|
-
|
|
7913
|
+
let dScale;
|
|
7914
|
+
if (this.svgFirstPathDraw) {
|
|
7915
|
+
dScale = pathScale;
|
|
7916
|
+
this.svgFirstPathDraw = false;
|
|
7917
|
+
} else {
|
|
7918
|
+
dScale = 1;
|
|
7919
|
+
}
|
|
7916
7920
|
const dX = x - this.svgPreviousAbsoluteX;
|
|
7917
7921
|
const dY = y - this.svgPreviousAbsoluteY;
|
|
7918
7922
|
return [dScale, 0, dX, 0, dScale, dY, 0, 0, 1];
|
|
7919
7923
|
}
|
|
7920
|
-
pathNeedsTransform(
|
|
7921
|
-
return
|
|
7924
|
+
pathNeedsTransform(x, y) {
|
|
7925
|
+
return this.svgFirstPathDraw === true || x !== this.svgPreviousAbsoluteX || y !== this.svgPreviousAbsoluteY;
|
|
7926
|
+
}
|
|
7927
|
+
shapeIsSvgStringPath() {
|
|
7928
|
+
var _a;
|
|
7929
|
+
return ((_a = this.path) == null ? void 0 : _a.svgPathString) !== void 0;
|
|
7930
|
+
}
|
|
7931
|
+
shapeIsM2Path() {
|
|
7932
|
+
var _a;
|
|
7933
|
+
return ((_a = this.path) == null ? void 0 : _a.subpaths) !== void 0;
|
|
7922
7934
|
}
|
|
7923
7935
|
drawCircle(canvas) {
|
|
7924
7936
|
if (!this.circleOfRadius) {
|