@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,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.animate = exports.handleSetupAnimation = exports.handleCancelAnimation = void 0;
|
|
4
|
+
var animations_constants_1 = require("./animations.constants");
|
|
5
|
+
var handleCancelAnimationFrame = function (animation) {
|
|
6
|
+
if (typeof animation === 'number') {
|
|
7
|
+
cancelAnimationFrame(animation);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var handleCancelAnimation = function (contextInstance) {
|
|
11
|
+
if (!contextInstance.mounted)
|
|
12
|
+
return;
|
|
13
|
+
handleCancelAnimationFrame(contextInstance.animation);
|
|
14
|
+
contextInstance.animate = false;
|
|
15
|
+
contextInstance.animation = null;
|
|
16
|
+
contextInstance.velocity = null;
|
|
17
|
+
};
|
|
18
|
+
exports.handleCancelAnimation = handleCancelAnimation;
|
|
19
|
+
function handleSetupAnimation(contextInstance, animationName, animationTime, callback) {
|
|
20
|
+
if (!contextInstance.mounted)
|
|
21
|
+
return;
|
|
22
|
+
var startTime = new Date().getTime();
|
|
23
|
+
var lastStep = 1;
|
|
24
|
+
(0, exports.handleCancelAnimation)(contextInstance);
|
|
25
|
+
contextInstance.animation = function () {
|
|
26
|
+
if (!contextInstance.mounted) {
|
|
27
|
+
return handleCancelAnimationFrame(contextInstance.animation);
|
|
28
|
+
}
|
|
29
|
+
var frameTime = new Date().getTime() - startTime;
|
|
30
|
+
var animationProgress = frameTime / animationTime;
|
|
31
|
+
var animationType = animations_constants_1.animations[animationName];
|
|
32
|
+
var step = animationType(animationProgress);
|
|
33
|
+
if (frameTime >= animationTime) {
|
|
34
|
+
callback(lastStep);
|
|
35
|
+
contextInstance.animation = null;
|
|
36
|
+
}
|
|
37
|
+
else if (contextInstance.animation) {
|
|
38
|
+
callback(step);
|
|
39
|
+
requestAnimationFrame(contextInstance.animation);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
requestAnimationFrame(contextInstance.animation);
|
|
43
|
+
}
|
|
44
|
+
exports.handleSetupAnimation = handleSetupAnimation;
|
|
45
|
+
function isValidTargetState(targetState) {
|
|
46
|
+
var scale = targetState.scale, positionX = targetState.positionX, positionY = targetState.positionY;
|
|
47
|
+
return !(Number.isNaN(scale) || Number.isNaN(positionX) || Number.isNaN(positionY));
|
|
48
|
+
}
|
|
49
|
+
function animate(contextInstance, targetState, animationTime, animationName) {
|
|
50
|
+
var isValid = isValidTargetState(targetState);
|
|
51
|
+
if (!contextInstance.mounted || !isValid)
|
|
52
|
+
return;
|
|
53
|
+
var setTransformState = contextInstance.setTransformState;
|
|
54
|
+
var _a = contextInstance.transformState, scale = _a.scale, positionX = _a.positionX, positionY = _a.positionY;
|
|
55
|
+
var scaleDiff = targetState.scale - scale;
|
|
56
|
+
var positionXDiff = targetState.positionX - positionX;
|
|
57
|
+
var positionYDiff = targetState.positionY - positionY;
|
|
58
|
+
if (animationTime === 0) {
|
|
59
|
+
setTransformState(targetState.scale, targetState.positionX, targetState.positionY);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
handleSetupAnimation(contextInstance, animationName, animationTime, function (step) {
|
|
63
|
+
var newScale = scale + scaleDiff * step;
|
|
64
|
+
var newPositionX = positionX + positionXDiff * step;
|
|
65
|
+
var newPositionY = positionY + positionYDiff * step;
|
|
66
|
+
setTransformState(newScale, newPositionX, newPositionY);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.animate = animate;
|
|
71
|
+
//# sourceMappingURL=animations.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animations.util.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/animations.util.ts"],"names":[],"mappings":";;;AAGA,+DAAmD;AAGnD,IAAM,0BAA0B,GAAG,UAAC,SAA+B;IACjE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QACjC,oBAAoB,CAAC,SAAS,CAAC,CAAA;KAChC;AACH,CAAC,CAAA;AAEM,IAAM,qBAAqB,GAAG,UACnC,eAAyC;IAEzC,IAAI,CAAC,eAAe,CAAC,OAAO;QAAE,OAAM;IACpC,0BAA0B,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;IAErD,eAAe,CAAC,OAAO,GAAG,KAAK,CAAA;IAC/B,eAAe,CAAC,SAAS,GAAG,IAAI,CAAA;IAChC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAA;AACjC,CAAC,CAAA;AATY,QAAA,qBAAqB,yBASjC;AAED,SAAgB,oBAAoB,CAClC,eAAyC,EACzC,aAAqB,EACrB,aAAq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AC,CAAA;AACrF,CAAC;AAED,SAAgB,OAAO,CACrB,eAAyC,EACzC,WAAsB,EACtB,aAAqB,EACrB,aAAqB;IAErB,IAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC/C,IAAI,CAAC,eAAe,CAAC,OAAO,IAAI,CAAC,OAAO;QAAE,OAAM;IAExC,IAAA,iBAAiB,GAAK,eAAe,kBAApB,CAAoB;IACvC,IAAA,KAAkC,eAAe,CAAC,cAAc,EAA9D,KAAK,WAAA,EAAE,SAAS,eAAA,EAAE,SAAS,eAAmC,CAAA;IAEtE,IAAM,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,KAAK,CAAA;IAC3C,IAAM,aAAa,GAAG,WAAW,CAAC,SAAS,GAAG,SAAS,CAAA;IACvD,IAAM,aAAa,GAAG,WAAW,CAAC,SAAS,GAAG,SAAS,CAAA;IAEvD,IAAI,aAAa,KAAK,CAAC,EAAE;QACvB,iBAAiB,CACf,WAAW,CAAC,KAAK,EACjB,WAAW,CAAC,SAAS,EACrB,WAAW,CAAC,SAAS,CACtB,CAAA;KACF;SAAM;QAEL,oBAAoB,CAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,UAAC,IAAY;YACX,IAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI,CAAA;YACzC,IAAM,YAAY,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAAA;YACrD,IAAM,YAAY,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAAA;YAErD,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;QACzD,CAAC,CACF,CAAA;KACF;AACH,CAAC;AArCD,0BAqCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoundsType, PositionType, ReactZoomPanPinchContext } from 'react-zoom-pan-pinch';
|
|
2
|
+
export declare function getComponentsSizes(wrapperComponent: HTMLDivElement, contentComponent: HTMLDivElement, newScale: number): any;
|
|
3
|
+
export declare const getBounds: (wrapperWidth: number, newContentWidth: number, diffWidth: number, wrapperHeight: number, newContentHeight: number, diffHeight: number, centerZoomedOut: boolean) => BoundsType;
|
|
4
|
+
export declare const calculateBounds: (contextInstance: ReactZoomPanPinchContext, newScale: number) => BoundsType;
|
|
5
|
+
export declare const boundLimiter: (value: number, minBound: number, maxBound: number, isActive: boolean) => number;
|
|
6
|
+
export declare const handleCalculateBounds: (contextInstance: ReactZoomPanPinchContext, newScale: number) => BoundsType;
|
|
7
|
+
export declare function getMouseBoundedPosition(positionX: number, positionY: number, bounds: BoundsType, limitToBounds: boolean, paddingValueX: number, paddingValueY: number, wrapperComponent: HTMLDivElement | null): PositionType;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMouseBoundedPosition = exports.handleCalculateBounds = exports.boundLimiter = exports.calculateBounds = exports.getBounds = exports.getComponentsSizes = void 0;
|
|
4
|
+
var calculation_util_1 = require("./calculation.util");
|
|
5
|
+
function getComponentsSizes(wrapperComponent, contentComponent, newScale) {
|
|
6
|
+
var wrapperWidth = wrapperComponent.offsetWidth;
|
|
7
|
+
var wrapperHeight = wrapperComponent.offsetHeight;
|
|
8
|
+
var contentWidth = contentComponent.offsetWidth;
|
|
9
|
+
var contentHeight = contentComponent.offsetHeight;
|
|
10
|
+
var newContentWidth = contentWidth * newScale;
|
|
11
|
+
var newContentHeight = contentHeight * newScale;
|
|
12
|
+
var newDiffWidth = wrapperWidth - newContentWidth;
|
|
13
|
+
var newDiffHeight = wrapperHeight - newContentHeight;
|
|
14
|
+
return {
|
|
15
|
+
wrapperWidth: wrapperWidth,
|
|
16
|
+
wrapperHeight: wrapperHeight,
|
|
17
|
+
newContentWidth: newContentWidth,
|
|
18
|
+
newDiffWidth: newDiffWidth,
|
|
19
|
+
newContentHeight: newContentHeight,
|
|
20
|
+
newDiffHeight: newDiffHeight
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.getComponentsSizes = getComponentsSizes;
|
|
24
|
+
var getBounds = function (wrapperWidth, newContentWidth, diffWidth, wrapperHeight, newContentHeight, diffHeight, centerZoomedOut) {
|
|
25
|
+
var scaleWidthFactor = wrapperWidth > newContentWidth
|
|
26
|
+
? diffWidth * (centerZoomedOut ? 1 : 0.5)
|
|
27
|
+
: 0;
|
|
28
|
+
var scaleHeightFactor = wrapperHeight > newContentHeight
|
|
29
|
+
? diffHeight * (centerZoomedOut ? 1 : 0.5)
|
|
30
|
+
: 0;
|
|
31
|
+
var minPositionX = wrapperWidth - newContentWidth - scaleWidthFactor;
|
|
32
|
+
var maxPositionX = scaleWidthFactor;
|
|
33
|
+
var minPositionY = wrapperHeight - newContentHeight - scaleHeightFactor;
|
|
34
|
+
var maxPositionY = scaleHeightFactor;
|
|
35
|
+
return { minPositionX: minPositionX, maxPositionX: maxPositionX, minPositionY: minPositionY, maxPositionY: maxPositionY };
|
|
36
|
+
};
|
|
37
|
+
exports.getBounds = getBounds;
|
|
38
|
+
var calculateBounds = function (contextInstance, newScale) {
|
|
39
|
+
var wrapperComponent = contextInstance.wrapperComponent, contentComponent = contextInstance.contentComponent;
|
|
40
|
+
var centerZoomedOut = contextInstance.setup.centerZoomedOut;
|
|
41
|
+
if (!wrapperComponent || !contentComponent) {
|
|
42
|
+
throw new Error('Components are not mounted');
|
|
43
|
+
}
|
|
44
|
+
var _a = getComponentsSizes(wrapperComponent, contentComponent, newScale), wrapperWidth = _a.wrapperWidth, wrapperHeight = _a.wrapperHeight, newContentWidth = _a.newContentWidth, newDiffWidth = _a.newDiffWidth, newContentHeight = _a.newContentHeight, newDiffHeight = _a.newDiffHeight;
|
|
45
|
+
return (0, exports.getBounds)(wrapperWidth, newContentWidth, newDiffWidth, wrapperHeight, newContentHeight, newDiffHeight, Boolean(centerZoomedOut));
|
|
46
|
+
};
|
|
47
|
+
exports.calculateBounds = calculateBounds;
|
|
48
|
+
var boundLimiter = function (value, minBound, maxBound, isActive) {
|
|
49
|
+
if (!isActive)
|
|
50
|
+
return (0, calculation_util_1.roundNumber)(value, 2);
|
|
51
|
+
if (value < minBound)
|
|
52
|
+
return (0, calculation_util_1.roundNumber)(minBound, 2);
|
|
53
|
+
if (value > maxBound)
|
|
54
|
+
return (0, calculation_util_1.roundNumber)(maxBound, 2);
|
|
55
|
+
return (0, calculation_util_1.roundNumber)(value, 2);
|
|
56
|
+
};
|
|
57
|
+
exports.boundLimiter = boundLimiter;
|
|
58
|
+
var handleCalculateBounds = function (contextInstance, newScale) {
|
|
59
|
+
var bounds = (0, exports.calculateBounds)(contextInstance, newScale);
|
|
60
|
+
contextInstance.bounds = bounds;
|
|
61
|
+
return bounds;
|
|
62
|
+
};
|
|
63
|
+
exports.handleCalculateBounds = handleCalculateBounds;
|
|
64
|
+
function getMouseBoundedPosition(positionX, positionY, bounds, limitToBounds, paddingValueX, paddingValueY, wrapperComponent) {
|
|
65
|
+
var minPositionX = bounds.minPositionX, minPositionY = bounds.minPositionY, maxPositionX = bounds.maxPositionX, maxPositionY = bounds.maxPositionY;
|
|
66
|
+
var paddingX = 0;
|
|
67
|
+
var paddingY = 0;
|
|
68
|
+
if (wrapperComponent) {
|
|
69
|
+
paddingX = paddingValueX;
|
|
70
|
+
paddingY = paddingValueY;
|
|
71
|
+
}
|
|
72
|
+
var x = (0, exports.boundLimiter)(positionX, minPositionX - paddingX, maxPositionX + paddingX, limitToBounds);
|
|
73
|
+
var y = (0, exports.boundLimiter)(positionY, minPositionY - paddingY, maxPositionY + paddingY, limitToBounds);
|
|
74
|
+
return { x: x, y: y };
|
|
75
|
+
}
|
|
76
|
+
exports.getMouseBoundedPosition = getMouseBoundedPosition;
|
|
77
|
+
//# sourceMappingURL=bounds.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounds.util.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/bounds.util.ts"],"names":[],"mappings":";;;AAIA,uD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Number = exports.roundNumber = void 0;
|
|
4
|
+
var roundNumber = function (num, decimal) {
|
|
5
|
+
return Number(num.toFixed(decimal));
|
|
6
|
+
};
|
|
7
|
+
exports.roundNumber = roundNumber;
|
|
8
|
+
var checkIsNumber = function (num, defaultValue) {
|
|
9
|
+
return typeof num === "number" ? num : defaultValue;
|
|
10
|
+
};
|
|
11
|
+
exports.checkIsNumber = checkIsNumber;
|
|
12
|
+
//# sourceMappingURL=calculation.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculation.util.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/calculation.util.ts"],"names":[],"mappings":";;;AAQO,IAAM,WAAW,GAAG,UAAC,GAAW,EAAE,OAAe;IACtD,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAOK,IAAM,aAAa,GAAG,UAAC,GAAQ,EAAE,YAAoB;IAC1D,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./animations.constants"), exports);
|
|
18
|
+
__exportStar(require("./animations.util"), exports);
|
|
19
|
+
__exportStar(require("./bounds.util"), exports);
|
|
20
|
+
__exportStar(require("./calculation.util"), exports);
|
|
21
|
+
__exportStar(require("./zoom.util"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,yDAAsC;AACtC,oDAAiC;AACjC,gDAA6B;AAC7B,qDAAkC;AAClC,8CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkZoomBounds(zoom: number, minScale: number, maxScale: number, zoomPadding: number, enablePadding: boolean): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkZoomBounds = void 0;
|
|
4
|
+
function checkZoomBounds(zoom, minScale, maxScale, zoomPadding, enablePadding) {
|
|
5
|
+
var scalePadding = enablePadding ? zoomPadding : 0;
|
|
6
|
+
var minScaleWithPadding = minScale - scalePadding;
|
|
7
|
+
if (!Number.isNaN(maxScale) && zoom >= maxScale)
|
|
8
|
+
return maxScale;
|
|
9
|
+
if (!Number.isNaN(minScale) && zoom <= minScaleWithPadding)
|
|
10
|
+
return minScaleWithPadding;
|
|
11
|
+
return zoom;
|
|
12
|
+
}
|
|
13
|
+
exports.checkZoomBounds = checkZoomBounds;
|
|
14
|
+
//# sourceMappingURL=zoom.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom.util.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/zoom.util.ts"],"names":[],"mappings":";;;AAGA,SAAgB,eAAe,CAC7B,IAAY,EACZ,QAAgB,EAChB,QAAgB,EAChB,WAAmB,EACnB,aAAsB;IAEtB,IAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IACpD,IAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,CAAA;IAEnD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAChE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,mBAAmB;QACxD,OAAO,mBAAmB,CAAA;IAC5B,OAAO,IAAI,CAAA;AACb,CAAC;AAdD,0CAcC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/react-game",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.24.2",
|
|
4
4
|
"description": "React components & tools to create a Board Game user interface for Game Park",
|
|
5
5
|
"author": "Romain Fromi <romain@game-park.com> (https://game-park.com/)",
|
|
6
6
|
"license": "ISC",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
28
28
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
29
29
|
"@gamepark/avataaars": "^2.2.0",
|
|
30
|
-
"@gamepark/react-client": "~6.
|
|
31
|
-
"@gamepark/rules-api": "~6.
|
|
30
|
+
"@gamepark/react-client": "~6.24.2",
|
|
31
|
+
"@gamepark/rules-api": "~6.24.2",
|
|
32
32
|
"dayjs": "^1.11.7",
|
|
33
33
|
"emotion-normalize": "^11.0.1",
|
|
34
34
|
"fscreen": "^1.2.0",
|