@gamepark/react-game 6.23.4 → 6.24.2
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/components/Header/MaterialHeader.js +2 -1
- package/dist/components/Header/MaterialHeader.js.map +1 -1
- package/dist/components/PlayerPanel/Counters.d.ts +13 -0
- package/dist/components/PlayerPanel/Counters.js +44 -0
- package/dist/components/PlayerPanel/Counters.js.map +1 -0
- package/dist/components/PlayerPanel/StyledPlayerPanel.d.ts +4 -2
- package/dist/components/PlayerPanel/StyledPlayerPanel.js +30 -25
- package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
- package/dist/components/PlayerPanel/index.d.ts +1 -0
- package/dist/components/PlayerPanel/index.js +1 -0
- package/dist/components/PlayerPanel/index.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +6 -6
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +13 -6
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/material/ComponentDescription.d.ts +14 -0
- package/dist/components/material/ComponentDescription.js +27 -0
- package/dist/components/material/ComponentDescription.js.map +1 -0
- package/dist/components/material/Dices/CubicDiceDescription.d.ts +1 -0
- package/dist/components/material/Dices/CubicDiceDescription.js +13 -0
- package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
- package/dist/components/material/DraggableMaterial.d.ts +1 -13
- package/dist/components/material/DraggableMaterial.js +37 -91
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/CardDescription.d.ts +2 -2
- package/dist/components/material/FlatMaterial/CardDescription.js +1 -1
- package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +4 -2
- package/dist/components/material/FlatMaterial/FlatMaterial.js +17 -11
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/TokenDescription.d.ts +1 -1
- package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.js +9 -7
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/ItemDisplay.d.ts +4 -2
- package/dist/components/material/GameTable/ItemDisplay.js +104 -15
- package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
- package/dist/components/material/GameTable/StaticItemsDisplay.js +2 -2
- package/dist/components/material/GameTable/StaticItemsDisplay.js.map +1 -1
- package/dist/components/material/GameTable/StaticLocationsDisplay.js +12 -12
- package/dist/components/material/GameTable/StaticLocationsDisplay.js.map +1 -1
- package/dist/components/material/GameTable/focus/FocusProvider.d.ts +6 -6
- package/dist/components/material/GameTable/focus/FocusProvider.js +2 -2
- package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
- package/dist/components/material/GameTable/focus/index.d.ts +0 -1
- package/dist/components/material/GameTable/focus/index.js +0 -1
- package/dist/components/material/GameTable/focus/index.js.map +1 -1
- package/dist/components/material/ImageLoader/MaterialImageLoader.js +17 -11
- package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -1
- package/dist/components/material/MaterialComponent.d.ts +0 -4
- package/dist/components/material/MaterialComponent.js +5 -18
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +5 -13
- package/dist/components/material/MaterialDescription.js +48 -22
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/Writing/WritingDescription.d.ts +0 -4
- package/dist/components/material/Writing/WritingDescription.js +0 -10
- package/dist/components/material/Writing/WritingDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.js +5 -3
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
- package/dist/components/material/animations/DeleteItemAnimations.js +7 -5
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ItemAnimations.d.ts +2 -1
- package/dist/components/material/animations/ItemAnimations.js +9 -0
- package/dist/components/material/animations/ItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MaterialAnimations.d.ts +2 -2
- package/dist/components/material/animations/MoveItemAnimations.d.ts +1 -2
- package/dist/components/material/animations/MoveItemAnimations.js +18 -31
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAtOnceAnimations.d.ts +1 -2
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js +14 -28
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
- package/dist/components/material/animations/RollItemAnimations.d.ts +1 -2
- package/dist/components/material/animations/RollItemAnimations.js +4 -15
- package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
- package/dist/components/material/animations/adjustRotation.d.ts +1 -1
- package/dist/components/material/animations/adjustRotation.js +60 -19
- package/dist/components/material/animations/adjustRotation.js.map +1 -1
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js +3 -6
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -1
- package/dist/components/material/animations/rotations.utils.d.ts +2 -0
- package/dist/components/material/animations/rotations.utils.js +99 -0
- package/dist/components/material/animations/rotations.utils.js.map +1 -0
- package/dist/components/material/animations/transformItem.util.js +3 -5
- package/dist/components/material/animations/transformItem.util.js.map +1 -1
- package/dist/components/material/index.d.ts +1 -0
- package/dist/components/material/index.js +1 -0
- package/dist/components/material/index.js.map +1 -1
- package/dist/components/material/locations/DropAreaDescription.d.ts +9 -0
- package/dist/components/material/locations/DropAreaDescription.js +46 -0
- package/dist/components/material/locations/DropAreaDescription.js.map +1 -0
- package/dist/components/material/locations/LocationComponent.d.ts +16 -0
- package/dist/components/material/locations/LocationComponent.js +89 -0
- package/dist/components/material/locations/LocationComponent.js.map +1 -0
- package/dist/components/material/locations/LocationDescription.d.ts +14 -25
- package/dist/components/material/locations/LocationDescription.js +43 -50
- package/dist/components/material/locations/LocationDescription.js.map +1 -1
- package/dist/components/material/locations/LocationDisplay.d.ts +4 -1
- package/dist/components/material/locations/LocationDisplay.js +4 -9
- package/dist/components/material/locations/LocationDisplay.js.map +1 -1
- package/dist/components/material/locations/LocationsMask.d.ts +2 -1
- package/dist/components/material/locations/LocationsMask.js +6 -6
- package/dist/components/material/locations/LocationsMask.js.map +1 -1
- package/dist/components/material/locations/SimpleDropArea.d.ts +4 -7
- package/dist/components/material/locations/SimpleDropArea.js +18 -88
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
- package/dist/components/material/locations/index.d.ts +1 -0
- package/dist/components/material/locations/index.js +1 -0
- package/dist/components/material/locations/index.js.map +1 -1
- package/dist/components/material/utils/isDroppedItem.js +12 -1
- package/dist/components/material/utils/isDroppedItem.js.map +1 -1
- package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -3
- package/dist/components/material/utils/isPlacedOnItem.js +5 -5
- package/dist/components/material/utils/isPlacedOnItem.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorial.js +4 -4
- package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorialDisplay.js +7 -6
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
- package/dist/components/tutorial/TutorialRulesWrapper.js +26 -26
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDraggedItem.d.ts +2 -0
- package/dist/hooks/useDraggedItem.js +19 -0
- package/dist/hooks/useDraggedItem.js.map +1 -0
- package/dist/hooks/useItemLocations.d.ts +8 -0
- package/dist/hooks/useItemLocations.js +83 -0
- package/dist/hooks/useItemLocations.js.map +1 -0
- package/dist/hooks/useItemLocator.d.ts +2 -2
- package/dist/hooks/useItemLocator.js.map +1 -1
- package/dist/hooks/useLegalMoves.js +4 -18
- package/dist/hooks/useLegalMoves.js.map +1 -1
- package/dist/hooks/usePlayers.js +14 -1
- package/dist/hooks/usePlayers.js.map +1 -1
- package/dist/hooks/useStaticLocations.d.ts +2 -0
- package/dist/hooks/useStaticLocations.js +53 -0
- package/dist/hooks/useStaticLocations.js.map +1 -0
- package/dist/hooks/useTutorialStep.js +2 -2
- package/dist/hooks/useTutorialStep.js.map +1 -1
- package/dist/hooks/useZoomToElements.d.ts +1 -1
- package/dist/hooks/useZoomToElements.js +8 -8
- package/dist/hooks/useZoomToElements.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/locators/DeckLocator.d.ts +5 -4
- package/dist/locators/DeckLocator.js +6 -8
- package/dist/locators/DeckLocator.js.map +1 -1
- package/dist/locators/FlexLocator.d.ts +18 -0
- package/dist/locators/FlexLocator.js +88 -0
- package/dist/locators/FlexLocator.js.map +1 -0
- package/dist/locators/HandLocator.d.ts +22 -13
- package/dist/locators/HandLocator.js +71 -39
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ListLocator.d.ts +18 -0
- package/dist/locators/ListLocator.js +97 -0
- package/dist/locators/ListLocator.js.map +1 -0
- package/dist/locators/Locator.d.ts +50 -0
- package/dist/locators/Locator.js +153 -0
- package/dist/locators/Locator.js.map +1 -0
- package/dist/locators/PileLocator.d.ts +12 -11
- package/dist/locators/PileLocator.js +44 -29
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/locators/index.d.ts +3 -3
- package/dist/locators/index.js +3 -3
- package/dist/locators/index.js.map +1 -1
- package/dist/utilities/combineEventListeners.js.map +1 -1
- package/dist/utilities/findIfUnique.util.js.map +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/translation.util.d.ts +5 -0
- package/dist/utilities/translation.util.js +33 -0
- package/dist/utilities/translation.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.d.ts +16 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.js +62 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.d.ts +4 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.js +71 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +7 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js +77 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +2 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/index.d.ts +5 -0
- package/dist/utilities/zoom-pan-pinch/index.js +22 -0
- package/dist/utilities/zoom-pan-pinch/index.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +1 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js +14 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Coordinates, DisplayedItem, Location, MaterialItem, MaterialRules, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationDescription, MaterialDescriptionRecord } from '../components';
|
|
3
|
+
export type SortFunction = ((item: MaterialItem) => number);
|
|
4
|
+
export declare class Locator<P extends number = number, M extends number = number, L extends number = number> {
|
|
5
|
+
constructor(clone?: Partial<Locator>);
|
|
6
|
+
protected itemTypes: M[];
|
|
7
|
+
parentItemType?: M;
|
|
8
|
+
limit?: number;
|
|
9
|
+
rotationUnit: string;
|
|
10
|
+
location?: Location<P, L>;
|
|
11
|
+
locations: Location<P, L>[];
|
|
12
|
+
getLocations(_context: MaterialContext<P, M, L>): Location<P, L>[];
|
|
13
|
+
locationDescription?: LocationDescription<P, M, L>;
|
|
14
|
+
getLocationDescription(location: Location<P, L>, context: MaterialContext<P, M, L> | ItemContext<P, M, L>): LocationDescription<P, M, L> | undefined;
|
|
15
|
+
protected generateLocationDescriptionFromDraggedItem(_location: Location<P, L>, context: ItemContext<P, M, L>): LocationDescription<P, M, L> | undefined;
|
|
16
|
+
hide(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): boolean;
|
|
17
|
+
placeLocation(location: Location<P, L>, context: LocationContext<P, M, L>): string[];
|
|
18
|
+
placeItem(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
|
|
19
|
+
protected placeItemOnParent(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
|
|
20
|
+
getParentItem(location: Location<P, L>, { rules, material }: MaterialContext<P, M, L>): MaterialItem<P, L> | undefined;
|
|
21
|
+
positionOnParent: XYCoordinates;
|
|
22
|
+
getPositionOnParent(_location: Location<P, L>, _context: MaterialContext<P, M, L>): XYCoordinates;
|
|
23
|
+
coordinates: Partial<Coordinates>;
|
|
24
|
+
getCoordinates(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Partial<Coordinates>;
|
|
25
|
+
getLocationCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>): Partial<Coordinates>;
|
|
26
|
+
getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
|
|
27
|
+
rotateZ: number;
|
|
28
|
+
getRotateZ(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
|
|
29
|
+
getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
|
|
30
|
+
getLocationIndex(location: Location<P, L>, _context: MaterialContext<P, M, L>): number | undefined;
|
|
31
|
+
getItemIndex(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
|
|
32
|
+
countItems(location: Location<P, L>, { rules }: MaterialContext<P, M, L>): number;
|
|
33
|
+
getHoverTransform(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string[];
|
|
34
|
+
navigationSorts: SortFunction[];
|
|
35
|
+
getNavigationSorts(_context: ItemContext<P, M, L>): SortFunction[];
|
|
36
|
+
}
|
|
37
|
+
export type ItemLocatorRecord<P extends number = number, M extends number = number, L extends number = number> = Record<L, Locator<P, M, L>>;
|
|
38
|
+
export type MaterialContext<P extends number = number, M extends number = number, L extends number = number> = {
|
|
39
|
+
rules: MaterialRules<P, M, L>;
|
|
40
|
+
material: Partial<MaterialDescriptionRecord<P, M, L>>;
|
|
41
|
+
locators: Partial<ItemLocatorRecord<P, M, L>>;
|
|
42
|
+
player?: P;
|
|
43
|
+
};
|
|
44
|
+
export type ItemContext<P extends number = number, M extends number = number, L extends number = number> = MaterialContext<P, M, L> & DisplayedItem<M> & {
|
|
45
|
+
dragTransform?: string;
|
|
46
|
+
};
|
|
47
|
+
export declare function isItemContext<P extends number = number, M extends number = number, L extends number = number>(context: MaterialContext<P, M, L>): context is ItemContext<P, M, L>;
|
|
48
|
+
export type LocationContext<P extends number = number, M extends number = number, L extends number = number> = MaterialContext<P, M, L> & {
|
|
49
|
+
canDrop?: boolean;
|
|
50
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.isItemContext = exports.Locator = void 0;
|
|
18
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
19
|
+
var sumBy_1 = __importDefault(require("lodash/sumBy"));
|
|
20
|
+
var components_1 = require("../components");
|
|
21
|
+
var Locator = (function () {
|
|
22
|
+
function Locator(clone) {
|
|
23
|
+
this.itemTypes = [];
|
|
24
|
+
this.rotationUnit = 'deg';
|
|
25
|
+
this.locations = [];
|
|
26
|
+
this.positionOnParent = { x: 50, y: 50 };
|
|
27
|
+
this.coordinates = { x: 0, y: 0, z: 0 };
|
|
28
|
+
this.rotateZ = 0;
|
|
29
|
+
this.navigationSorts = [function (item) { var _a; return (_a = item.location.x) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.y) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.z) !== null && _a !== void 0 ? _a : 0; }];
|
|
30
|
+
Object.assign(this, clone);
|
|
31
|
+
}
|
|
32
|
+
Locator.prototype.getLocations = function (_context) {
|
|
33
|
+
return this.location ? [this.location] : this.locations;
|
|
34
|
+
};
|
|
35
|
+
Locator.prototype.getLocationDescription = function (location, context) {
|
|
36
|
+
if (!this.locationDescription) {
|
|
37
|
+
if (this.parentItemType !== undefined && location.x === undefined && location.y === undefined && location.z === undefined) {
|
|
38
|
+
var material = context.material[this.parentItemType];
|
|
39
|
+
if (material) {
|
|
40
|
+
this.locationDescription = new components_1.DropAreaDescription(material);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (isItemContext(context)) {
|
|
44
|
+
return this.generateLocationDescriptionFromDraggedItem(location, context);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return this.locationDescription;
|
|
48
|
+
};
|
|
49
|
+
Locator.prototype.generateLocationDescriptionFromDraggedItem = function (_location, context) {
|
|
50
|
+
return new components_1.DropAreaDescription(context.material[context.type]);
|
|
51
|
+
};
|
|
52
|
+
Locator.prototype.hide = function (item, context) {
|
|
53
|
+
return this.limit ? this.getItemIndex(item, context) >= this.limit : false;
|
|
54
|
+
};
|
|
55
|
+
Locator.prototype.placeLocation = function (location, context) {
|
|
56
|
+
var transform = [];
|
|
57
|
+
var _a = this.getLocationCoordinates(location, context), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
|
|
58
|
+
if (x || y || z) {
|
|
59
|
+
transform.push("translate3d(".concat(x, "em, ").concat(y, "em, ").concat(z, "em)"));
|
|
60
|
+
}
|
|
61
|
+
var rotateZ = this.getRotateZ(location, context);
|
|
62
|
+
if (rotateZ) {
|
|
63
|
+
transform.push("rotateZ(".concat(rotateZ).concat(this.rotationUnit, ")"));
|
|
64
|
+
}
|
|
65
|
+
if (context.canDrop)
|
|
66
|
+
transform.push('translateZ(5em)');
|
|
67
|
+
return transform;
|
|
68
|
+
};
|
|
69
|
+
Locator.prototype.placeItem = function (item, context) {
|
|
70
|
+
if (!this.itemTypes.includes(context.type)) {
|
|
71
|
+
this.itemTypes.push(context.type);
|
|
72
|
+
}
|
|
73
|
+
var transform = this.placeItemOnParent(item, context);
|
|
74
|
+
var _a = this.getItemCoordinates(item, context), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
|
|
75
|
+
if (x || y || z) {
|
|
76
|
+
transform.push("translate3d(".concat(x, "em, ").concat(y, "em, ").concat(z, "em)"));
|
|
77
|
+
}
|
|
78
|
+
var rotateZ = this.getItemRotateZ(item, context);
|
|
79
|
+
if (rotateZ) {
|
|
80
|
+
transform.push("rotateZ(".concat(rotateZ).concat(this.rotationUnit, ")"));
|
|
81
|
+
}
|
|
82
|
+
return transform;
|
|
83
|
+
};
|
|
84
|
+
Locator.prototype.placeItemOnParent = function (item, context) {
|
|
85
|
+
var _a;
|
|
86
|
+
var parentItem = this.getParentItem(item.location, context);
|
|
87
|
+
if (this.parentItemType === undefined || !parentItem)
|
|
88
|
+
return [];
|
|
89
|
+
var locator = context.locators[parentItem.location.type];
|
|
90
|
+
var parentContext = __assign(__assign({}, context), { type: this.parentItemType, displayIndex: 0 });
|
|
91
|
+
var transform = (_a = locator === null || locator === void 0 ? void 0 : locator.placeItem(parentItem, parentContext)) !== null && _a !== void 0 ? _a : [];
|
|
92
|
+
var parentMaterial = context.material[this.parentItemType];
|
|
93
|
+
var _b = this.getPositionOnParent(item.location, context), x = _b.x, y = _b.y;
|
|
94
|
+
if (parentMaterial && (x !== 0 || y !== 0)) {
|
|
95
|
+
var _c = parentMaterial.getSize(parentItem.id), width = _c.width, height = _c.height;
|
|
96
|
+
transform.push("translate3d(".concat(width * (x - 50) / 100, "em, ").concat(height * (y - 50) / 100, "em, ").concat(parentMaterial.getThickness(parentItem, parentContext), "em)"));
|
|
97
|
+
}
|
|
98
|
+
return transform;
|
|
99
|
+
};
|
|
100
|
+
Locator.prototype.getParentItem = function (location, _a) {
|
|
101
|
+
var _b;
|
|
102
|
+
var rules = _a.rules, material = _a.material;
|
|
103
|
+
if (this.parentItemType === undefined)
|
|
104
|
+
return undefined;
|
|
105
|
+
if (location.parent === undefined)
|
|
106
|
+
return (_b = material[this.parentItemType]) === null || _b === void 0 ? void 0 : _b.staticItem;
|
|
107
|
+
return rules.material(this.parentItemType).getItem(location.parent);
|
|
108
|
+
};
|
|
109
|
+
Locator.prototype.getPositionOnParent = function (_location, _context) {
|
|
110
|
+
return this.positionOnParent;
|
|
111
|
+
};
|
|
112
|
+
Locator.prototype.getCoordinates = function (_location, _context) {
|
|
113
|
+
return this.coordinates;
|
|
114
|
+
};
|
|
115
|
+
Locator.prototype.getLocationCoordinates = function (location, context) {
|
|
116
|
+
return this.getCoordinates(location, context);
|
|
117
|
+
};
|
|
118
|
+
Locator.prototype.getItemCoordinates = function (item, context) {
|
|
119
|
+
return this.getLocationCoordinates(item.location, context);
|
|
120
|
+
};
|
|
121
|
+
Locator.prototype.getRotateZ = function (_location, _context) {
|
|
122
|
+
return this.rotateZ;
|
|
123
|
+
};
|
|
124
|
+
Locator.prototype.getItemRotateZ = function (item, context) {
|
|
125
|
+
return this.getRotateZ(item.location, context);
|
|
126
|
+
};
|
|
127
|
+
Locator.prototype.getLocationIndex = function (location, _context) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
return (_b = (_a = location.x) !== null && _a !== void 0 ? _a : location.y) !== null && _b !== void 0 ? _b : location.z;
|
|
130
|
+
};
|
|
131
|
+
Locator.prototype.getItemIndex = function (item, context) {
|
|
132
|
+
var _a;
|
|
133
|
+
return (_a = this.getLocationIndex(item.location, context)) !== null && _a !== void 0 ? _a : context.displayIndex;
|
|
134
|
+
};
|
|
135
|
+
Locator.prototype.countItems = function (location, _a) {
|
|
136
|
+
var rules = _a.rules;
|
|
137
|
+
return (0, sumBy_1.default)(this.itemTypes, function (type) { return rules.material(type).location(function (itemLocation) { return (0, rules_api_1.isSameLocationArea)(itemLocation, location); }).getQuantity(); });
|
|
138
|
+
};
|
|
139
|
+
Locator.prototype.getHoverTransform = function (_item, _context) {
|
|
140
|
+
return [];
|
|
141
|
+
};
|
|
142
|
+
Locator.prototype.getNavigationSorts = function (_context) {
|
|
143
|
+
return this.navigationSorts;
|
|
144
|
+
};
|
|
145
|
+
return Locator;
|
|
146
|
+
}());
|
|
147
|
+
exports.Locator = Locator;
|
|
148
|
+
function isItemContext(context) {
|
|
149
|
+
var itemContext = context;
|
|
150
|
+
return itemContext.type !== undefined && itemContext.index !== undefined && itemContext.displayIndex !== undefined;
|
|
151
|
+
}
|
|
152
|
+
exports.isItemContext = isItemContext;
|
|
153
|
+
//# sourceMappingURL=Locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Locator.js","sourceRoot":"","sources":["../../src/locators/Locator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,iDAA0I;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AAO,CAAC,YAAY,CAAA;IAC9E,CAAC;IASD,4BAAU,GAAV,UAAW,QAAwB,EAAE,EAAmC;YAAjC,KAAK,WAAA;QAC1C,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,SAAS,EAAE,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAA,YAAY,IAAI,OAAA,IAAA,8BAAkB,EAAC,YAAY,EAAE,QAAQ,CAAC,EAA1C,CAA0C,CAAC,CAAC,WAAW,EAAE,EAAvG,CAAuG,CAAC,CAAA;IAC/I,CAAC;IAQD,mCAAiB,GAAjB,UAAkB,KAAyB,EAAE,QAA8B;QACzE,OAAO,EAAE,CAAA;IACX,CAAC;IAYD,oCAAkB,GAAlB,UAAmB,QAA8B;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IACH,cAAC;AAAD,CAAC,AAvTD,IAuTC;AAvTY,0BAAO;AAyVpB,SAAgB,aAAa,CAC3B,OAAiC;IAEjC,IAAM,WAAW,GAAG,OAA+B,CAAA;IACnD,OAAO,WAAW,CAAC,IAAI,KAAK,SAAS,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,IAAI,WAAW,CAAC,YAAY,KAAK,SAAS,CAAA;AACpH,CAAC;AALD,sCAKC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { Coordinates, MaterialItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Coordinates, Location, MaterialItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
|
+
import { LocationDescription } from '../components';
|
|
3
|
+
import { ItemContext, Locator, MaterialContext } from './Locator';
|
|
4
|
+
export declare class PileLocator<P extends number = number, M extends number = number, L extends number = number> extends Locator<P, M, L> {
|
|
5
|
+
constructor(clone?: Partial<PileLocator>);
|
|
5
6
|
private positions;
|
|
6
7
|
private rotations;
|
|
7
|
-
|
|
8
|
-
getRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
|
|
9
|
-
coordinates: Coordinates;
|
|
10
|
-
getCoordinates(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): Coordinates;
|
|
8
|
+
limit: number;
|
|
11
9
|
radius: number | XYCoordinates;
|
|
12
|
-
getRadius(
|
|
10
|
+
getRadius(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | XYCoordinates;
|
|
13
11
|
maxAngle: number;
|
|
14
|
-
getMaxAngle(
|
|
15
|
-
getPileId(item: MaterialItem<P, L>,
|
|
12
|
+
getMaxAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
|
|
13
|
+
getPileId(item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string;
|
|
14
|
+
getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
|
|
15
|
+
getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
|
|
16
|
+
protected generateLocationDescriptionFromDraggedItem(location: Location<P, L>, context: ItemContext<P, M, L>): LocationDescription<P, M, L>;
|
|
16
17
|
}
|
|
@@ -16,66 +16,81 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PileLocator = void 0;
|
|
19
|
-
var
|
|
19
|
+
var components_1 = require("../components");
|
|
20
|
+
var Locator_1 = require("./Locator");
|
|
20
21
|
var PileLocator = (function (_super) {
|
|
21
22
|
__extends(PileLocator, _super);
|
|
22
|
-
function PileLocator() {
|
|
23
|
-
var _this = _super
|
|
24
|
-
_this.limit = 20;
|
|
23
|
+
function PileLocator(clone) {
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
25
|
_this.positions = new Map();
|
|
26
26
|
_this.rotations = new Map();
|
|
27
|
-
_this.
|
|
27
|
+
_this.limit = 20;
|
|
28
28
|
_this.radius = 0;
|
|
29
29
|
_this.maxAngle = 180;
|
|
30
|
+
Object.assign(_this, clone);
|
|
30
31
|
return _this;
|
|
31
32
|
}
|
|
32
|
-
PileLocator.prototype.
|
|
33
|
+
PileLocator.prototype.getRadius = function (_location, _context) {
|
|
34
|
+
return this.radius;
|
|
35
|
+
};
|
|
36
|
+
PileLocator.prototype.getMaxAngle = function (_location, _context) {
|
|
37
|
+
return this.maxAngle;
|
|
38
|
+
};
|
|
39
|
+
PileLocator.prototype.getPileId = function (item, _context) {
|
|
40
|
+
return [item.location.player, item.location.id, item.location.parent].filter(function (part) { return part !== undefined; }).join('_');
|
|
41
|
+
};
|
|
42
|
+
PileLocator.prototype.getItemCoordinates = function (item, context) {
|
|
43
|
+
var location = item.location;
|
|
44
|
+
var index = this.getItemIndex(item, context);
|
|
33
45
|
var pileId = this.getPileId(item, context);
|
|
34
46
|
if (!this.positions.has(pileId))
|
|
35
47
|
this.positions.set(pileId, new Map());
|
|
36
48
|
var pilePositions = this.positions.get(pileId);
|
|
37
|
-
var
|
|
38
|
-
var radius = this.getRadius(item, context);
|
|
49
|
+
var radius = this.getRadius(location, context);
|
|
39
50
|
if (!pilePositions.has(index)) {
|
|
40
|
-
var
|
|
51
|
+
var _a = this.getCoordinates(location, context), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
|
|
41
52
|
var distance = Math.random();
|
|
42
53
|
var direction = Math.random() * 2 * Math.PI;
|
|
43
54
|
pilePositions.set(index, {
|
|
44
|
-
x:
|
|
45
|
-
y:
|
|
46
|
-
z:
|
|
55
|
+
x: x + Math.cos(direction) * Math.sqrt(distance) * (typeof radius === 'number' ? radius : radius.x),
|
|
56
|
+
y: y + Math.sin(direction) * Math.sqrt(distance) * (typeof radius === 'number' ? radius : radius.y),
|
|
57
|
+
z: z + index * 0.05
|
|
47
58
|
});
|
|
48
59
|
}
|
|
49
60
|
return pilePositions.get(index);
|
|
50
61
|
};
|
|
51
|
-
PileLocator.prototype.
|
|
62
|
+
PileLocator.prototype.getItemRotateZ = function (item, context) {
|
|
52
63
|
var _a;
|
|
53
|
-
|
|
54
|
-
return 0;
|
|
64
|
+
var index = this.getItemIndex(item, context);
|
|
55
65
|
var pileId = this.getPileId(item, context);
|
|
56
66
|
if (!this.rotations.has(pileId))
|
|
57
67
|
this.rotations.set(pileId, new Map());
|
|
58
68
|
var pileRotations = this.rotations.get(pileId);
|
|
59
|
-
var index = this.getItemIndex(item, context);
|
|
60
69
|
if (!pileRotations.has(index)) {
|
|
61
|
-
var maxAngle = this.getMaxAngle(item, context);
|
|
70
|
+
var maxAngle = this.getMaxAngle(item.location, context);
|
|
62
71
|
pileRotations.set(index, (Math.random() - 0.5) * maxAngle);
|
|
63
72
|
}
|
|
64
73
|
return (_a = pileRotations.get(index)) !== null && _a !== void 0 ? _a : 0;
|
|
65
74
|
};
|
|
66
|
-
PileLocator.prototype.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
PileLocator.prototype.generateLocationDescriptionFromDraggedItem = function (location, context) {
|
|
76
|
+
var _a;
|
|
77
|
+
var itemDescription = (_a = context.material[context.type]) !== null && _a !== void 0 ? _a : new components_1.CardDescription();
|
|
78
|
+
var item = context.rules.material(context.type).getItem(context.index);
|
|
79
|
+
var _b = itemDescription.getSize(item.id), width = _b.width, height = _b.height;
|
|
80
|
+
if (this.getMaxAngle(location, context) < 180) {
|
|
81
|
+
return new components_1.DropAreaDescription(itemDescription);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
var max = Math.max(width, height);
|
|
85
|
+
var radius = this.getRadius(location, context);
|
|
86
|
+
return new components_1.DropAreaDescription({
|
|
87
|
+
width: max + (typeof radius === 'number' ? radius * 2 : radius.x * 2),
|
|
88
|
+
height: max + (typeof radius === 'number' ? radius * 2 : radius.y * 2),
|
|
89
|
+
borderRadius: max / 2 + (typeof radius === 'number' ? radius : Math.max(radius.x, radius.y))
|
|
90
|
+
});
|
|
91
|
+
}
|
|
77
92
|
};
|
|
78
93
|
return PileLocator;
|
|
79
|
-
}(
|
|
94
|
+
}(Locator_1.Locator));
|
|
80
95
|
exports.PileLocator = PileLocator;
|
|
81
96
|
//# sourceMappingURL=PileLocator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PileLocator.js","sourceRoot":"","sources":["../../src/locators/PileLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"PileLocator.js","sourceRoot":"","sources":["../../src/locators/PileLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAyF;AACzF,qCAAiE;AAKjE;IAAkH,+BAAgB;IAEhI,qBAAY,KAA4B;QAAxC,YACE,iBAAO,SAER;QAEO,eAAS,GAAG,IAAI,GAAG,EAAoC,CAAA;QACvD,eAAS,GAAG,IAAI,GAAG,EAA+B,CAAA;QAK1D,WAAK,GAAG,EAAE,CAAA;QAKV,YAAM,GAA2B,CAAC,CAAA;QAelC,cAAQ,GAAG,GAAG,CAAA;QA7BZ,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,KAAK,CAAC,CAAA;;IAC5B,CAAC;IAqBD,+BAAS,GAAT,UAAU,SAAyB,EAAE,QAAkC;QACrE,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAaD,iCAAW,GAAX,UAAY,SAAyB,EAAE,QAAkC;QACvE,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAQD,+BAAS,GAAT,UAAU,IAAwB,EAAE,QAA8B;QAChE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UA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C,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;aAC7F,CAAC,CAAA;SACH;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAvGD,CAAkH,iBAAO,GAuGxH;AAvGY,kCAAW"}
|
package/dist/locators/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './utils';
|
|
2
2
|
export * from './DeckLocator';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './FlexLocator';
|
|
4
4
|
export * from './HandLocator';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './Locator';
|
|
6
|
+
export * from './ListLocator';
|
|
7
7
|
export * from './PileLocator';
|
package/dist/locators/index.js
CHANGED
|
@@ -16,9 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./utils"), exports);
|
|
18
18
|
__exportStar(require("./DeckLocator"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./FlexLocator"), exports);
|
|
20
20
|
__exportStar(require("./HandLocator"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./Locator"), exports);
|
|
22
|
+
__exportStar(require("./ListLocator"), exports);
|
|
23
23
|
__exportStar(require("./PileLocator"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,gDAA6B;AAC7B,gDAA6B;AAC7B,gDAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/locators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,gDAA6B;AAC7B,gDAA6B;AAC7B,gDAA6B;AAC7B,4CAAyB;AACzB,gDAA6B;AAC7B,gDAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combineEventListeners.js","sourceRoot":"","sources":["../../src/utilities/combineEventListeners.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"combineEventListeners.js","sourceRoot":"","sources":["../../src/utilities/combineEventListeners.ts"],"names":[],"mappings":";;;AAMA,SAAgB,qBAAqB,CAAmB,SAAY,EAAE,KAA0B;IAC9F,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,UAAC,MAAM,EAAE,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAC1D,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;YAAC,cAAY;iBAAZ,UAAY,EAAZ,qBAAY,EAAZ,IAAY;gBAAZ,yBAAY;;YAC5D,KAAK,eAAI,IAAI,EAAC;YACd,OAAO,KAAK,CAAC,GAAG,CAAC,OAAV,KAAK,EAAS,IAAI,EAAC;QAC5B,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QACT,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,EAAE,CAAM,CAAA;AACb,CAAC;AARD,sDAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findIfUnique.util.js","sourceRoot":"","sources":["../../src/utilities/findIfUnique.util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"findIfUnique.util.js","sourceRoot":"","sources":["../../src/utilities/findIfUnique.util.ts"],"names":[],"mappings":";;;AAMA,SAAgB,YAAY,CAAI,UAAwB,EAAE,SAAyE;IACjI,IAAI,MAAM,GAAG,SAAS,CAAA;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;QACvB,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE;YAC/B,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAA;YAC1C,MAAM,GAAG,CAAC,CAAA;SACX;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAVD,oCAUC"}
|
package/dist/utilities/index.js
CHANGED
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./combineEventListeners"), exports);
|
|
18
18
|
__exportStar(require("./DeepPartial"), exports);
|
|
19
19
|
__exportStar(require("./findIfUnique.util"), exports);
|
|
20
|
+
__exportStar(require("./translation.util"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,gDAA6B;AAC7B,sDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,gDAA6B;AAC7B,sDAAmC;AACnC,qDAAkC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.setupTranslation = void 0;
|
|
18
|
+
var i18next_1 = __importDefault(require("i18next"));
|
|
19
|
+
var i18next_icu_1 = __importDefault(require("i18next-icu"));
|
|
20
|
+
var dayjs_1 = __importDefault(require("dayjs"));
|
|
21
|
+
require("dayjs/locale/de");
|
|
22
|
+
require("dayjs/locale/fr");
|
|
23
|
+
require("dayjs/locale/ru");
|
|
24
|
+
var react_i18next_1 = require("react-i18next");
|
|
25
|
+
var setupTranslation = function (translations, options) {
|
|
26
|
+
i18next_1.default.use(react_i18next_1.initReactI18next).use(i18next_icu_1.default);
|
|
27
|
+
var query = new URLSearchParams(window.location.search);
|
|
28
|
+
var locale = query.get('locale') || 'en';
|
|
29
|
+
i18next_1.default.init(__assign({ lng: locale, debug: process.env.NODE_ENV === 'development', fallbackLng: 'en', keySeparator: false, nsSeparator: false, resources: translations }, options)).catch(function (error) { return console.error(error); });
|
|
30
|
+
dayjs_1.default.locale(locale);
|
|
31
|
+
};
|
|
32
|
+
exports.setupTranslation = setupTranslation;
|
|
33
|
+
//# sourceMappingURL=translation.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.util.js","sourceRoot":"","sources":["../../src/utilities/translation.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAsD;AACtD,4DAA6B;AAC7B,gDAAyB;AACzB,2BAAwB;AACxB,2BAAwB;AACxB,2BAAwB;AACxB,+CAA8C;AAOvC,IAAM,gBAAgB,GAAG,UAAC,YAAsB,EAAE,OAAqB;IAC5E,iBAAO,CAAC,GAAG,CAAC,gCAAgB,CAAC,CAAC,GAAG,CAAC,qBAAG,CAAC,CAAA;IAEtC,IAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,IAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAA;IAE1C,iBAAO,CAAC,IAAI,YACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAC7C,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,KAAK,EACnB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,YAAY,IACpB,OAAO,EACV,CAAC,KAAK,CAAC,UAAA,KAAK,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC,CAAA;IAEvC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC,CAAA;AAjBY,QAAA,gBAAgB,oBAiB5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const animations: {
|
|
2
|
+
easeOut: (t: number) => number;
|
|
3
|
+
linear: (t: number) => number;
|
|
4
|
+
easeInQuad: (t: number) => number;
|
|
5
|
+
easeOutQuad: (t: number) => number;
|
|
6
|
+
easeInOutQuad: (t: number) => number;
|
|
7
|
+
easeInCubic: (t: number) => number;
|
|
8
|
+
easeOutCubic: (t: number) => number;
|
|
9
|
+
easeInOutCubic: (t: number) => number;
|
|
10
|
+
easeInQuart: (t: number) => number;
|
|
11
|
+
easeOutQuart: (t: number) => number;
|
|
12
|
+
easeInOutQuart: (t: number) => number;
|
|
13
|
+
easeInQuint: (t: number) => number;
|
|
14
|
+
easeOutQuint: (t: number) => number;
|
|
15
|
+
easeInOutQuint: (t: number) => number;
|
|
16
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.animations = void 0;
|
|
4
|
+
var easeOut = function (t) {
|
|
5
|
+
return -Math.cos(t * Math.PI) / 2 + 0.5;
|
|
6
|
+
};
|
|
7
|
+
var linear = function (t) {
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
var easeInQuad = function (t) {
|
|
11
|
+
return t * t;
|
|
12
|
+
};
|
|
13
|
+
var easeOutQuad = function (t) {
|
|
14
|
+
return t * (2 - t);
|
|
15
|
+
};
|
|
16
|
+
var easeInOutQuad = function (t) {
|
|
17
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
18
|
+
};
|
|
19
|
+
var easeInCubic = function (t) {
|
|
20
|
+
return t * t * t;
|
|
21
|
+
};
|
|
22
|
+
var easeOutCubic = function (t) {
|
|
23
|
+
return --t * t * t + 1;
|
|
24
|
+
};
|
|
25
|
+
var easeInOutCubic = function (t) {
|
|
26
|
+
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
27
|
+
};
|
|
28
|
+
var easeInQuart = function (t) {
|
|
29
|
+
return t * t * t * t;
|
|
30
|
+
};
|
|
31
|
+
var easeOutQuart = function (t) {
|
|
32
|
+
return 1 - --t * t * t * t;
|
|
33
|
+
};
|
|
34
|
+
var easeInOutQuart = function (t) {
|
|
35
|
+
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
|
|
36
|
+
};
|
|
37
|
+
var easeInQuint = function (t) {
|
|
38
|
+
return t * t * t * t * t;
|
|
39
|
+
};
|
|
40
|
+
var easeOutQuint = function (t) {
|
|
41
|
+
return 1 + --t * t * t * t * t;
|
|
42
|
+
};
|
|
43
|
+
var easeInOutQuint = function (t) {
|
|
44
|
+
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
|
|
45
|
+
};
|
|
46
|
+
exports.animations = {
|
|
47
|
+
easeOut: easeOut,
|
|
48
|
+
linear: linear,
|
|
49
|
+
easeInQuad: easeInQuad,
|
|
50
|
+
easeOutQuad: easeOutQuad,
|
|
51
|
+
easeInOutQuad: easeInOutQuad,
|
|
52
|
+
easeInCubic: easeInCubic,
|
|
53
|
+
easeOutCubic: easeOutCubic,
|
|
54
|
+
easeInOutCubic: easeInOutCubic,
|
|
55
|
+
easeInQuart: easeInQuart,
|
|
56
|
+
easeOutQuart: easeOutQuart,
|
|
57
|
+
easeInOutQuart: easeInOutQuart,
|
|
58
|
+
easeInQuint: easeInQuint,
|
|
59
|
+
easeOutQuint: easeOutQuint,
|
|
60
|
+
easeInOutQuint: easeInOutQuint
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=animations.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.constants.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/animations.constants.ts"],"names":[],"mappings":";;;AAOA,IAAM,OAAO,GAAG,UAAC,CAAS;IACxB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;AACzC,CAAC,CAAA;AAED,IAAM,MAAM,GAAG,UAAC,CAAS;IACvB,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAED,IAAM,UAAU,GAAG,UAAC,CAAS;IAC3B,OAAO,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAA;AAED,IAAM,WAAW,GAAG,UAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA;AAED,IAAM,aAAa,GAAG,UAAC,CAAS;IAC9B,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,IAAM,WAAW,GAAG,UAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CAAA;AAED,IAAM,YAAY,GAAG,UAAC,CAAS;IAC7B,OAAO,EAAE,C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E,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACxE,CAAC,CAAA;AAEY,QAAA,UAAU,GAAG;IACxB,OAAO,SAAA;IACP,MAAM,QAAA;IACN,UAAU,YAAA;IACV,WAAW,aAAA;IACX,aAAa,eAAA;IACb,WAAW,aAAA;IACX,YAAY,cAAA;IACZ,cAAc,gBAAA;IACd,WAAW,aAAA;IACX,YAAY,cAAA;IACZ,cAAc,gBAAA;IACd,WAAW,aAAA;IACX,YAAY,cAAA;IACZ,cAAc,gBAAA;CACf,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactZoomPanPinchContext, StateType } from 'react-zoom-pan-pinch';
|
|
2
|
+
export declare const handleCancelAnimation: (contextInstance: ReactZoomPanPinchContext) => void;
|
|
3
|
+
export declare function handleSetupAnimation(contextInstance: ReactZoomPanPinchContext, animationName: string, animationTime: number, callback: (step: number) => void): void;
|
|
4
|
+
export declare function animate(contextInstance: ReactZoomPanPinchContext, targetState: StateType, animationTime: number, animationName: string): void;
|