@pretty-chitty/core 1.1.2 → 1.2.1
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/BottomBarButton.d.ts +2 -1
- package/dist/components/BottomBarButton.d.ts.map +1 -1
- package/dist/components/BottomBarButton.js +2 -1
- package/dist/components/BottomBarButton.js.map +1 -1
- package/dist/components/ClientTrustMatchViewer.d.ts +4 -1
- package/dist/components/ClientTrustMatchViewer.d.ts.map +1 -1
- package/dist/components/ClientTrustMatchViewer.js +11 -4
- package/dist/components/ClientTrustMatchViewer.js.map +1 -1
- package/dist/components/ContextGalleryDisplay.js +1 -1
- package/dist/components/ContextGalleryDisplay.js.map +1 -1
- package/dist/components/DemoWrapper.d.ts +9 -0
- package/dist/components/DemoWrapper.d.ts.map +1 -0
- package/dist/components/DemoWrapper.js +76 -0
- package/dist/components/DemoWrapper.js.map +1 -0
- package/dist/components/FullScreenGalleryDisplay.d.ts +2 -0
- package/dist/components/FullScreenGalleryDisplay.d.ts.map +1 -0
- package/dist/components/FullScreenGalleryDisplay.js +56 -0
- package/dist/components/FullScreenGalleryDisplay.js.map +1 -0
- package/dist/components/Gallery/AnimationController.d.ts +19 -0
- package/dist/components/Gallery/AnimationController.d.ts.map +1 -0
- package/dist/components/Gallery/AnimationController.js +82 -0
- package/dist/components/Gallery/AnimationController.js.map +1 -0
- package/dist/components/Gallery/BuiltItem.d.ts +58 -0
- package/dist/components/Gallery/BuiltItem.d.ts.map +1 -0
- package/dist/components/Gallery/BuiltItem.js +313 -0
- package/dist/components/Gallery/BuiltItem.js.map +1 -0
- package/dist/components/Gallery/CameraManager.d.ts +14 -0
- package/dist/components/Gallery/CameraManager.d.ts.map +1 -0
- package/dist/components/Gallery/CameraManager.js +43 -0
- package/dist/components/Gallery/CameraManager.js.map +1 -0
- package/dist/components/Gallery/GalleryController.d.ts +30 -0
- package/dist/components/Gallery/GalleryController.d.ts.map +1 -0
- package/dist/components/Gallery/GalleryController.js +137 -0
- package/dist/components/Gallery/GalleryController.js.map +1 -0
- package/dist/components/Gallery/GalleryViewer.d.ts +18 -0
- package/dist/components/Gallery/GalleryViewer.d.ts.map +1 -0
- package/dist/components/Gallery/GalleryViewer.js +141 -0
- package/dist/components/Gallery/GalleryViewer.js.map +1 -0
- package/dist/components/Gallery/LayoutManager.d.ts +49 -0
- package/dist/components/Gallery/LayoutManager.d.ts.map +1 -0
- package/dist/components/Gallery/LayoutManager.js +132 -0
- package/dist/components/Gallery/LayoutManager.js.map +1 -0
- package/dist/components/Gallery/constants.d.ts +13 -0
- package/dist/components/Gallery/constants.d.ts.map +1 -0
- package/dist/components/Gallery/constants.js +13 -0
- package/dist/components/Gallery/constants.js.map +1 -0
- package/dist/components/Gallery/index.d.ts +3 -0
- package/dist/components/Gallery/index.d.ts.map +1 -0
- package/dist/components/Gallery/index.js +2 -0
- package/dist/components/Gallery/index.js.map +1 -0
- package/dist/components/Gallery/types.d.ts +45 -0
- package/dist/components/Gallery/types.d.ts.map +1 -0
- package/dist/components/Gallery/types.js +2 -0
- package/dist/components/Gallery/types.js.map +1 -0
- package/dist/components/GalleryPlayground.js +1 -1
- package/dist/components/GalleryPlayground.js.map +1 -1
- package/dist/components/GalleryViewer.d.ts +2 -47
- package/dist/components/GalleryViewer.d.ts.map +1 -1
- package/dist/components/GalleryViewer.js +3 -569
- package/dist/components/GalleryViewer.js.map +1 -1
- package/dist/components/GameDesigner.d.ts.map +1 -1
- package/dist/components/GameDesigner.js +13 -2
- package/dist/components/GameDesigner.js.map +1 -1
- package/dist/components/InlineGalleryDisplay.d.ts +2 -0
- package/dist/components/InlineGalleryDisplay.d.ts.map +1 -0
- package/dist/components/InlineGalleryDisplay.js +69 -0
- package/dist/components/InlineGalleryDisplay.js.map +1 -0
- package/dist/components/LiveButton.d.ts.map +1 -1
- package/dist/components/LiveButton.js +1 -1
- package/dist/components/LiveButton.js.map +1 -1
- package/dist/components/MatchViewer.d.ts +0 -1
- package/dist/components/MatchViewer.d.ts.map +1 -1
- package/dist/components/MatchViewer.js +20 -10
- package/dist/components/MatchViewer.js.map +1 -1
- package/dist/components/Panel/MultiPanel.d.ts.map +1 -1
- package/dist/components/Panel/MultiPanel.js +14 -7
- package/dist/components/Panel/MultiPanel.js.map +1 -1
- package/dist/components/Panel/PanelContents.d.ts +2 -1
- package/dist/components/Panel/PanelContents.d.ts.map +1 -1
- package/dist/components/Panel/PanelContents.js +16 -11
- package/dist/components/Panel/PanelContents.js.map +1 -1
- package/dist/components/Panel/SinglePanel.d.ts.map +1 -1
- package/dist/components/Panel/SinglePanel.js +4 -3
- package/dist/components/Panel/SinglePanel.js.map +1 -1
- package/dist/components/Panel/ViewerWrapper.d.ts +1 -3
- package/dist/components/Panel/ViewerWrapper.d.ts.map +1 -1
- package/dist/components/Panel/ViewerWrapper.js +2 -3
- package/dist/components/Panel/ViewerWrapper.js.map +1 -1
- package/dist/components/Playground.d.ts.map +1 -1
- package/dist/components/Playground.js +353 -50
- package/dist/components/Playground.js.map +1 -1
- package/dist/components/PromptControls.d.ts.map +1 -1
- package/dist/components/PromptControls.js +39 -6
- package/dist/components/PromptControls.js.map +1 -1
- package/dist/components/ServerTrustMatchViewer.d.ts +11 -0
- package/dist/components/ServerTrustMatchViewer.d.ts.map +1 -0
- package/dist/components/ServerTrustMatchViewer.js +26 -0
- package/dist/components/ServerTrustMatchViewer.js.map +1 -0
- package/dist/components/Viewer.d.ts.map +1 -1
- package/dist/components/Viewer.js +54 -14
- package/dist/components/Viewer.js.map +1 -1
- package/dist/game/Chit.d.ts +6 -2
- package/dist/game/Chit.d.ts.map +1 -1
- package/dist/game/Chit.js +50 -6
- package/dist/game/Chit.js.map +1 -1
- package/dist/game/ClientTimeState.d.ts +1 -0
- package/dist/game/ClientTimeState.d.ts.map +1 -1
- package/dist/game/ClientTimeState.js +4 -1
- package/dist/game/ClientTimeState.js.map +1 -1
- package/dist/game/GalleryItemChitChildrenSource.d.ts +1 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts.map +1 -1
- package/dist/game/GalleryItemChitChildrenSource.js +1 -0
- package/dist/game/GalleryItemChitChildrenSource.js.map +1 -1
- package/dist/game/GalleryItemRawSource.d.ts +1 -0
- package/dist/game/GalleryItemRawSource.d.ts.map +1 -1
- package/dist/game/GalleryItemRawSource.js +1 -0
- package/dist/game/GalleryItemRawSource.js.map +1 -1
- package/dist/game/Game.d.ts +2 -1
- package/dist/game/Game.d.ts.map +1 -1
- package/dist/game/GameButton.d.ts +1 -0
- package/dist/game/GameButton.d.ts.map +1 -1
- package/dist/game/GameButton.js +2 -0
- package/dist/game/GameButton.js.map +1 -1
- package/dist/game/GameDeckChit.d.ts +6 -0
- package/dist/game/GameDeckChit.d.ts.map +1 -1
- package/dist/game/GameDeckChit.js +32 -5
- package/dist/game/GameDeckChit.js.map +1 -1
- package/dist/game/GameMetaData.d.ts +18 -0
- package/dist/game/GameMetaData.d.ts.map +1 -0
- package/dist/game/GameMetaData.js +2 -0
- package/dist/game/GameMetaData.js.map +1 -0
- package/dist/game/GameTheme.d.ts +11 -0
- package/dist/game/GameTheme.d.ts.map +1 -1
- package/dist/game/GameTheme.js +19 -4
- package/dist/game/GameTheme.js.map +1 -1
- package/dist/game/Match.d.ts +2 -1
- package/dist/game/Match.d.ts.map +1 -1
- package/dist/game/Match.js +4 -3
- package/dist/game/Match.js.map +1 -1
- package/dist/game/MatchStorage.d.ts +10 -0
- package/dist/game/MatchStorage.d.ts.map +1 -1
- package/dist/game/MatchStorage.js +29 -0
- package/dist/game/MatchStorage.js.map +1 -1
- package/dist/game/ModalState.d.ts +1 -0
- package/dist/game/ModalState.d.ts.map +1 -1
- package/dist/game/ModalState.js +1 -0
- package/dist/game/ModalState.js.map +1 -1
- package/dist/game/OrderedOutlet.d.ts.map +1 -1
- package/dist/game/OrderedOutlet.js +6 -6
- package/dist/game/OrderedOutlet.js.map +1 -1
- package/dist/game/Pick.d.ts +11 -1
- package/dist/game/Pick.d.ts.map +1 -1
- package/dist/game/Pick.js +83 -1
- package/dist/game/Pick.js.map +1 -1
- package/dist/game/PlayerChit.d.ts +2 -1
- package/dist/game/PlayerChit.d.ts.map +1 -1
- package/dist/game/PlayerChit.js +13 -1
- package/dist/game/PlayerChit.js.map +1 -1
- package/dist/game/PlayerInfo.d.ts +2 -1
- package/dist/game/PlayerInfo.d.ts.map +1 -1
- package/dist/game/PlayerInfo.js +20 -3
- package/dist/game/PlayerInfo.js.map +1 -1
- package/dist/game/Prompt.d.ts +1 -11
- package/dist/game/Prompt.d.ts.map +1 -1
- package/dist/game/Prompt.js +0 -32
- package/dist/game/Prompt.js.map +1 -1
- package/dist/game/RootChit.d.ts +4 -0
- package/dist/game/RootChit.d.ts.map +1 -1
- package/dist/game/RootChit.js +36 -1
- package/dist/game/RootChit.js.map +1 -1
- package/dist/game/Turn.d.ts +9 -8
- package/dist/game/Turn.d.ts.map +1 -1
- package/dist/game/Turn.js +34 -34
- package/dist/game/Turn.js.map +1 -1
- package/dist/game/TurnState.d.ts +3 -2
- package/dist/game/TurnState.d.ts.map +1 -1
- package/dist/game/TurnState.js +22 -2
- package/dist/game/TurnState.js.map +1 -1
- package/dist/game/badAiTransport/BadAIClientPrompts.d.ts +14 -0
- package/dist/game/badAiTransport/BadAIClientPrompts.d.ts.map +1 -0
- package/dist/game/badAiTransport/BadAIClientPrompts.js +50 -0
- package/dist/game/badAiTransport/BadAIClientPrompts.js.map +1 -0
- package/dist/game/clientTransport/ClientTime.js +1 -1
- package/dist/game/clientTransport/ClientTime.js.map +1 -1
- package/dist/game/serverTransport/ServerTime.d.ts.map +1 -1
- package/dist/game/serverTransport/ServerTime.js +1 -1
- package/dist/game/serverTransport/ServerTime.js.map +1 -1
- package/dist/hooks/useButtonGalleriesOptions.d.ts +4 -0
- package/dist/hooks/useButtonGalleriesOptions.d.ts.map +1 -0
- package/dist/hooks/useButtonGalleriesOptions.js +7 -0
- package/dist/hooks/useButtonGalleriesOptions.js.map +1 -0
- package/dist/hooks/useEventChannelState.js +1 -1
- package/dist/hooks/useEventChannelState.js.map +1 -1
- package/dist/hooks/useLoadingStates.d.ts +17 -0
- package/dist/hooks/useLoadingStates.d.ts.map +1 -0
- package/dist/hooks/useLoadingStates.js +44 -0
- package/dist/hooks/useLoadingStates.js.map +1 -0
- package/dist/hooks/useModalState.d.ts +2 -1
- package/dist/hooks/useModalState.d.ts.map +1 -1
- package/dist/hooks/useModalState.js +2 -2
- package/dist/hooks/useModalState.js.map +1 -1
- package/dist/hooks/usePanelPositioning.d.ts +0 -1
- package/dist/hooks/usePanelPositioning.d.ts.map +1 -1
- package/dist/hooks/usePanelPositioning.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.js +1 -1
- package/dist/rendering/CameraWrapperPerspective.js.map +1 -1
- package/dist/rendering/ChitGalleryItemInstance.d.ts +2 -0
- package/dist/rendering/ChitGalleryItemInstance.d.ts.map +1 -1
- package/dist/rendering/ChitGalleryItemInstance.js +2 -0
- package/dist/rendering/ChitGalleryItemInstance.js.map +1 -1
- package/dist/rendering/ChitRenderInstance.d.ts +13 -2
- package/dist/rendering/ChitRenderInstance.d.ts.map +1 -1
- package/dist/rendering/ChitRenderInstance.js +95 -47
- package/dist/rendering/ChitRenderInstance.js.map +1 -1
- package/dist/rendering/ChitRenderSpec.d.ts +3 -0
- package/dist/rendering/ChitRenderSpec.d.ts.map +1 -1
- package/dist/rendering/ChitRenderSpec.js +3 -0
- package/dist/rendering/ChitRenderSpec.js.map +1 -1
- package/dist/rendering/RootChitRenderInstance.d.ts +5 -2
- package/dist/rendering/RootChitRenderInstance.d.ts.map +1 -1
- package/dist/rendering/RootChitRenderInstance.js +76 -13
- package/dist/rendering/RootChitRenderInstance.js.map +1 -1
- package/dist/rendering/SplayCounter.d.ts.map +1 -1
- package/dist/rendering/SplayCounter.js +1 -1
- package/dist/rendering/SplayCounter.js.map +1 -1
- package/dist/rendering/TextureReferenceCounter.d.ts +1 -1
- package/dist/rendering/TextureReferenceCounter.d.ts.map +1 -1
- package/dist/rendering/TextureReferenceCounter.js +10 -10
- package/dist/rendering/TextureReferenceCounter.js.map +1 -1
- package/dist/rendering/outline/passes/DepthOcclusionPass.js +1 -1
- package/dist/rendering/outline/passes/DepthOcclusionPass.js.map +1 -1
- package/dist/utilities/Annotations.d.ts +59 -0
- package/dist/utilities/Annotations.d.ts.map +1 -1
- package/dist/utilities/Annotations.js +63 -0
- package/dist/utilities/Annotations.js.map +1 -1
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts +10 -1
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts.map +1 -1
- package/dist/utilities/CanvasStack/CanvasOperations.js +8 -0
- package/dist/utilities/CanvasStack/CanvasOperations.js.map +1 -1
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts +4 -2
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts.map +1 -1
- package/dist/utilities/CanvasStack/ReactCanvas.js +5 -2
- package/dist/utilities/CanvasStack/ReactCanvas.js.map +1 -1
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts.map +1 -1
- package/dist/utilities/CanvasStack/RichTextRenderer.js +12 -4
- package/dist/utilities/CanvasStack/RichTextRenderer.js.map +1 -1
- package/dist/utilities/EventChannel.d.ts.map +1 -1
- package/dist/utilities/EventChannel.js +2 -3
- package/dist/utilities/EventChannel.js.map +1 -1
- package/dist/utilities/GlbLoader.d.ts +15 -0
- package/dist/utilities/GlbLoader.d.ts.map +1 -0
- package/dist/utilities/GlbLoader.js +212 -0
- package/dist/utilities/GlbLoader.js.map +1 -0
- package/dist/utilities/LayoutHelper.js +23 -2
- package/dist/utilities/LayoutHelper.js.map +1 -1
- package/dist/utilities/ObjectWithProps.d.ts.map +1 -1
- package/dist/utilities/ObjectWithProps.js +32 -3
- package/dist/utilities/ObjectWithProps.js.map +1 -1
- package/package.json +6 -5
- package/src/library/components/BottomBarButton.tsx +3 -0
- package/src/library/components/ClientTrustMatchViewer.tsx +23 -8
- package/src/library/components/ContextGalleryDisplay.tsx +2 -2
- package/src/library/components/DemoWrapper.tsx +113 -0
- package/src/library/components/{GalleryDisplay.tsx → FullScreenGalleryDisplay.tsx} +28 -2
- package/src/library/components/Gallery/AnimationController.ts +110 -0
- package/src/library/components/Gallery/BuiltItem.ts +385 -0
- package/src/library/components/Gallery/CameraManager.ts +54 -0
- package/src/library/components/Gallery/GalleryController.ts +193 -0
- package/src/library/components/Gallery/GalleryViewer.tsx +211 -0
- package/src/library/components/Gallery/LayoutManager.ts +166 -0
- package/src/library/components/Gallery/constants.ts +12 -0
- package/src/library/components/Gallery/index.ts +2 -0
- package/src/library/components/Gallery/types.ts +55 -0
- package/src/library/components/GalleryPlayground.tsx +1 -1
- package/src/library/components/GalleryViewer.tsx +4 -773
- package/src/library/components/GameDesigner.tsx +21 -4
- package/src/library/components/InlineGalleryDisplay.tsx +101 -0
- package/src/library/components/LiveButton.tsx +2 -1
- package/src/library/components/MatchViewer.tsx +32 -14
- package/src/library/components/Panel/MultiPanel.tsx +20 -8
- package/src/library/components/Panel/PanelContents.tsx +17 -12
- package/src/library/components/Panel/SinglePanel.tsx +5 -4
- package/src/library/components/Panel/ViewerWrapper.tsx +0 -5
- package/src/library/components/Playground.tsx +692 -119
- package/src/library/components/PromptControls.tsx +61 -8
- package/src/library/components/ServerTrustMatchViewer.tsx +53 -0
- package/src/library/components/Viewer.tsx +60 -20
- package/src/library/game/Chit.ts +53 -6
- package/src/library/game/ClientTimeState.ts +5 -1
- package/src/library/game/GalleryItemChitChildrenSource.ts +2 -0
- package/src/library/game/GalleryItemRawSource.ts +2 -0
- package/src/library/game/Game.ts +3 -1
- package/src/library/game/GameButton.ts +3 -0
- package/src/library/game/GameDeckChit.ts +36 -5
- package/src/library/game/GameMetaData.ts +19 -0
- package/src/library/game/GameTheme.ts +23 -5
- package/src/library/game/Match.ts +4 -3
- package/src/library/game/MatchStorage.ts +37 -0
- package/src/library/game/ModalState.ts +1 -0
- package/src/library/game/OrderedOutlet.ts +6 -6
- package/src/library/game/Pick.ts +98 -2
- package/src/library/game/PlayerChit.ts +13 -1
- package/src/library/game/PlayerInfo.ts +22 -3
- package/src/library/game/Prompt.ts +1 -36
- package/src/library/game/RootChit.ts +41 -1
- package/src/library/game/Turn.ts +37 -40
- package/src/library/game/TurnState.ts +22 -3
- package/src/library/game/badAiTransport/BadAIClientPrompts.ts +60 -0
- package/src/library/game/clientTransport/ClientTime.ts +1 -1
- package/src/library/game/serverTransport/ServerTime.ts +2 -2
- package/src/library/hooks/useButtonGalleriesOptions.tsx +9 -0
- package/src/library/hooks/useEventChannelState.ts +1 -1
- package/src/library/hooks/useLoadingStates.tsx +55 -0
- package/src/library/hooks/useModalState.tsx +2 -2
- package/src/library/hooks/usePanelPositioning.tsx +0 -1
- package/src/library/index.ts +21 -1
- package/src/library/rendering/CameraWrapperPerspective.ts +10 -12
- package/src/library/rendering/ChitGalleryItemInstance.ts +2 -0
- package/src/library/rendering/ChitRenderInstance.ts +119 -61
- package/src/library/rendering/ChitRenderSpec.ts +4 -0
- package/src/library/rendering/RootChitRenderInstance.ts +87 -13
- package/src/library/rendering/SplayCounter.tsx +2 -1
- package/src/library/rendering/TextureReferenceCounter.ts +9 -9
- package/src/library/rendering/outline/passes/DepthOcclusionPass.ts +1 -1
- package/src/library/utilities/Annotations.ts +99 -0
- package/src/library/utilities/CanvasStack/CanvasOperations.tsx +19 -1
- package/src/library/utilities/CanvasStack/ReactCanvas.tsx +10 -3
- package/src/library/utilities/CanvasStack/RichTextRenderer.ts +14 -4
- package/src/library/utilities/EventChannel.ts +2 -4
- package/src/library/utilities/GlbLoader.ts +292 -0
- package/src/library/utilities/LayoutHelper.ts +28 -2
- package/src/library/utilities/ObjectWithProps.ts +27 -3
- package/dist/components/GalleryDisplay.d.ts +0 -2
- package/dist/components/GalleryDisplay.d.ts.map +0 -1
- package/dist/components/GalleryDisplay.js +0 -42
- package/dist/components/GalleryDisplay.js.map +0 -1
- package/dist/utilities/OutlineCanvas.d.ts +0 -12
- package/dist/utilities/OutlineCanvas.d.ts.map +0 -1
- package/dist/utilities/OutlineCanvas.js +0 -31
- package/dist/utilities/OutlineCanvas.js.map +0 -1
- package/dist/utilities/OutlineGeometry.d.ts +0 -3
- package/dist/utilities/OutlineGeometry.d.ts.map +0 -1
- package/dist/utilities/OutlineGeometry.js +0 -57
- package/dist/utilities/OutlineGeometry.js.map +0 -1
- package/src/library/utilities/OutlineCanvas.tsx +0 -45
- package/src/library/utilities/OutlineGeometry.ts +0 -69
|
@@ -36,7 +36,7 @@ export class ServerTime<P extends PlayerChit, R extends RootChit<P>> extends Con
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
private stateCounter = 0;
|
|
39
|
-
private stateLookups: { [
|
|
39
|
+
private stateLookups: { [chitState: string]: number } = {};
|
|
40
40
|
async serializeDelta(to: number) {
|
|
41
41
|
if (this.match.turn.value) {
|
|
42
42
|
const result = this.match.turn.value.serialize(this.playerId, to);
|
|
@@ -46,7 +46,7 @@ export class ServerTime<P extends PlayerChit, R extends RootChit<P>> extends Con
|
|
|
46
46
|
Object.entries(result.chits).forEach(([key, value]: [string, string]) => {
|
|
47
47
|
let state = this.stateLookups[value];
|
|
48
48
|
if (state === undefined) {
|
|
49
|
-
state = this.stateLookups[
|
|
49
|
+
state = this.stateLookups[value] = ++this.stateCounter;
|
|
50
50
|
newStates[this.stateCounter] = Chit.fixVisibility(value, this.playerId);
|
|
51
51
|
}
|
|
52
52
|
chitIdToStateCounter[key] = state;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import useLocalStorageState from "use-local-storage-state";
|
|
2
|
+
|
|
3
|
+
type GalleryDisplayMode = "inline" | "modal";
|
|
4
|
+
|
|
5
|
+
export function useButtonGalleriesOptions() {
|
|
6
|
+
return useLocalStorageState<GalleryDisplayMode>("galleryFullScreen", {
|
|
7
|
+
defaultValue: "inline",
|
|
8
|
+
});
|
|
9
|
+
}
|
|
@@ -5,7 +5,7 @@ export function useEventChannelState<T>(e: EventChannel<T>): [T, (a: T) => void]
|
|
|
5
5
|
const [v, setV] = useState<T>(e.value);
|
|
6
6
|
|
|
7
7
|
useEffect(() => {
|
|
8
|
-
// calling explicitly here saves a `
|
|
8
|
+
// calling explicitly here saves a `queueMicrotask` scheduling and fixes the problem where a value
|
|
9
9
|
// changes between when this is invoked and when useEffect is invoked.
|
|
10
10
|
setV(e.value);
|
|
11
11
|
e.on(setV, false);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type LoadingStatesCallback = (panelsCreated: number, panelsLoaded: number) => void;
|
|
4
|
+
|
|
5
|
+
export class LoadingStates {
|
|
6
|
+
private cbs: LoadingStatesCallback[] = [];
|
|
7
|
+
private loadingMap: { [id: string]: boolean } = {};
|
|
8
|
+
private errored = false;
|
|
9
|
+
|
|
10
|
+
setLoading(key: string, isLoading: boolean) {
|
|
11
|
+
if (this.loadingMap[key] !== isLoading) {
|
|
12
|
+
this.loadingMap[key] = isLoading;
|
|
13
|
+
this.notify();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
markError() {
|
|
18
|
+
this.errored = true;
|
|
19
|
+
this.notify();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public onChange(cb: LoadingStatesCallback): () => void {
|
|
23
|
+
this.cbs.push(cb);
|
|
24
|
+
setTimeout(() => this.notify(), 0);
|
|
25
|
+
return () => {
|
|
26
|
+
this.cbs = this.cbs.filter((c) => c !== cb);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private notify() {
|
|
31
|
+
if (!this.errored) {
|
|
32
|
+
const values = Object.values(this.loadingMap);
|
|
33
|
+
const loaded = values.filter((v) => !v);
|
|
34
|
+
this.cbs.forEach((cb) => cb(values.length, loaded.length));
|
|
35
|
+
} else {
|
|
36
|
+
this.cbs.forEach((cb) => cb(1, 1));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const LoadingStateContext = createContext<LoadingStates>(new LoadingStates());
|
|
42
|
+
|
|
43
|
+
export function useLoadingState(): LoadingStates {
|
|
44
|
+
return useContext(LoadingStateContext);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function LoadingStateProvider({
|
|
48
|
+
children,
|
|
49
|
+
loadingStates,
|
|
50
|
+
}: {
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
loadingStates: LoadingStates;
|
|
53
|
+
}) {
|
|
54
|
+
return <LoadingStateContext.Provider value={loadingStates}>{children}</LoadingStateContext.Provider>;
|
|
55
|
+
}
|
|
@@ -8,6 +8,6 @@ export function useModalState(): ModalState {
|
|
|
8
8
|
return result;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function ModalProvider({ children }: { children: ReactNode }) {
|
|
12
|
-
return <ModalContext.Provider value={
|
|
11
|
+
export function ModalProvider({ children, modalState }: { modalState: ModalState; children: ReactNode }) {
|
|
12
|
+
return <ModalContext.Provider value={modalState}>{children}</ModalContext.Provider>;
|
|
13
13
|
}
|
package/src/library/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @group Core Game Elements */
|
|
2
2
|
export type { Game } from "./game/Game";
|
|
3
|
+
/** @group Core Game Elements */
|
|
4
|
+
export type { GameMetaData } from "./game/GameMetaData";
|
|
3
5
|
|
|
4
6
|
// NOTE: must be before Turn! or circular dependency!
|
|
5
7
|
/** @group Chits */
|
|
@@ -29,7 +31,9 @@ export { DiceChit } from "./utilities/Dice";
|
|
|
29
31
|
/** @group Chit Annotations */
|
|
30
32
|
export { OrderedOutlet } from "./game/OrderedOutlet";
|
|
31
33
|
/** @group Chit Annotations */
|
|
32
|
-
export { ChildOutlet, NonEditable, Ordered } from "./utilities/Annotations";
|
|
34
|
+
export { ChildOutlet, NonEditable, Ordered, Selectable } from "./utilities/Annotations";
|
|
35
|
+
/** @group Chit Annotations */
|
|
36
|
+
export type { SelectableChoice, SelectableConfig, SelectablePropertyInfo } from "./utilities/Annotations";
|
|
33
37
|
|
|
34
38
|
/** @group Buttons */
|
|
35
39
|
export { GameButton, DynamicGameButton, ToggleGalleryButton } from "./game/GameButton";
|
|
@@ -57,6 +61,8 @@ export { Splay } from "./rendering/Splay";
|
|
|
57
61
|
/** @group Utilities */
|
|
58
62
|
export { extrudeSVGToGeometry } from "./utilities/SvgExtruder";
|
|
59
63
|
/** @group Utilities */
|
|
64
|
+
export { loadGLB } from "./utilities/GlbLoader";
|
|
65
|
+
/** @group Utilities */
|
|
60
66
|
export { CardMesh } from "./utilities/CardMesh";
|
|
61
67
|
|
|
62
68
|
//
|
|
@@ -76,10 +82,24 @@ export type { Stage } from "./game/GameDeckChit";
|
|
|
76
82
|
export { PlayerInfo } from "./game/PlayerInfo";
|
|
77
83
|
/** @group Supporting Types */
|
|
78
84
|
export type { IPlayerInfo } from "./game/PlayerInfo";
|
|
85
|
+
/** @internal */
|
|
79
86
|
/** @group Supporting Types */
|
|
80
87
|
export { MatchViewer } from "./components/MatchViewer";
|
|
88
|
+
/** @internal */
|
|
89
|
+
/** @group Supporting Types */
|
|
90
|
+
export { DemoWrapper } from "./components/DemoWrapper";
|
|
91
|
+
/** @internal */
|
|
92
|
+
/** @group Supporting Types */
|
|
93
|
+
export { Match } from "./game/Match";
|
|
94
|
+
/** @internal */
|
|
95
|
+
/** @group Supporting Types */
|
|
96
|
+
export { Connection } from "./game/Connection";
|
|
97
|
+
/** @internal */
|
|
81
98
|
/** @group Supporting Types */
|
|
82
99
|
export { ClientTrustMatchViewer } from "./components/ClientTrustMatchViewer";
|
|
100
|
+
/** @internal */
|
|
101
|
+
/** @group Supporting Types */
|
|
102
|
+
export { ServerTrustMatchViewer } from "./components/ServerTrustMatchViewer";
|
|
83
103
|
/** @group Supporting Types */
|
|
84
104
|
export type { BottomBarButtonIcon } from "./components/BottomBarButton";
|
|
85
105
|
/** @group Supporting Types */
|
|
@@ -119,7 +119,7 @@ export class CameraWrapperPerspective {
|
|
|
119
119
|
this.rotationTween.stop();
|
|
120
120
|
this.nearFarTween.stop();
|
|
121
121
|
this.camera.updateProjectionMatrix();
|
|
122
|
-
this.adjust(this.bbox);
|
|
122
|
+
this.adjust(this.bbox, true);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
public get zoom() {
|
|
@@ -583,17 +583,15 @@ export class CameraWrapperPerspective {
|
|
|
583
583
|
|
|
584
584
|
// Always tween near/far if they differ, even slightly
|
|
585
585
|
if (nearFarDistance > 0.001) {
|
|
586
|
-
this.nearFarTween = this.chit.createTween(
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
.
|
|
592
|
-
.
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
this.camera.updateProjectionMatrix();
|
|
596
|
-
}),
|
|
586
|
+
this.nearFarTween = this.chit.createTween({ near: currentNear, far: currentFar }, (tween) =>
|
|
587
|
+
tween
|
|
588
|
+
.to({ near: optimalPlanes.near, far: optimalPlanes.far }, duration)
|
|
589
|
+
.easing(Easing.Quadratic.InOut)
|
|
590
|
+
.onUpdate((obj) => {
|
|
591
|
+
this.camera.near = obj.near;
|
|
592
|
+
this.camera.far = obj.far;
|
|
593
|
+
this.camera.updateProjectionMatrix();
|
|
594
|
+
}),
|
|
597
595
|
);
|
|
598
596
|
} else if (nearFarDistance > 0) {
|
|
599
597
|
// If difference is tiny, just set immediately
|
|
@@ -20,8 +20,10 @@ export class ChitGalleryItemInstance implements GalleryItem {
|
|
|
20
20
|
|
|
21
21
|
originalSummary?: string;
|
|
22
22
|
summary?: string;
|
|
23
|
+
shortSummary?: string;
|
|
23
24
|
summaryIconMap?: IconMap;
|
|
24
25
|
summaryRenderingOptions?: RichTextRenderOptionsParameters;
|
|
26
|
+
shortSummaryRenderingOptions?: RichTextRenderOptionsParameters;
|
|
25
27
|
|
|
26
28
|
private sceneWrapper: SceneWrapper | undefined;
|
|
27
29
|
|
|
@@ -2,16 +2,12 @@ import {
|
|
|
2
2
|
Box3,
|
|
3
3
|
BoxGeometry,
|
|
4
4
|
Euler,
|
|
5
|
-
FrontSide,
|
|
6
5
|
Group,
|
|
7
6
|
Mesh,
|
|
8
7
|
MeshBasicMaterial,
|
|
9
|
-
MeshPhongMaterial,
|
|
10
8
|
Plane,
|
|
11
|
-
PlaneGeometry,
|
|
12
9
|
Quaternion,
|
|
13
10
|
Raycaster,
|
|
14
|
-
Shape,
|
|
15
11
|
Vector2,
|
|
16
12
|
Vector3,
|
|
17
13
|
Color as ThreeColor,
|
|
@@ -20,12 +16,9 @@ import { Chit } from "../game/Chit";
|
|
|
20
16
|
import { ChitRenderSpec, OwnerOriginPosition } from "./ChitRenderSpec";
|
|
21
17
|
import { Easing, Tween, Group as TweenGroup } from "@tweenjs/tween.js";
|
|
22
18
|
import { RootChitRenderInstance } from "./RootChitRenderInstance";
|
|
23
|
-
import { OutlineCanvas } from "../utilities/OutlineCanvas";
|
|
24
|
-
import { outlineGeometry } from "../utilities/OutlineGeometry";
|
|
25
19
|
import { fixBbox } from "../utilities/BboxUtils";
|
|
26
20
|
import { ChitGalleryItemInstance } from "./ChitGalleryItemInstance";
|
|
27
21
|
import Color from "color";
|
|
28
|
-
import nextTick from "next-tick";
|
|
29
22
|
|
|
30
23
|
const LINE_COLOR = new MeshBasicMaterial({ color: 0xff0000, wireframe: true, wireframeLinewidth: 2 });
|
|
31
24
|
const CLICK_LINE_COLOR = new MeshBasicMaterial({ color: 0xffff00, wireframe: true, wireframeLinewidth: 2 });
|
|
@@ -44,6 +37,11 @@ interface PointZ {
|
|
|
44
37
|
z: number;
|
|
45
38
|
}
|
|
46
39
|
|
|
40
|
+
export type DragHandler = {
|
|
41
|
+
duringDrag: (dx: number, dy: number) => void;
|
|
42
|
+
finishDrag: () => void;
|
|
43
|
+
};
|
|
44
|
+
|
|
47
45
|
class DestroyedError extends Error {}
|
|
48
46
|
|
|
49
47
|
export class ChitRenderInstance {
|
|
@@ -55,6 +53,7 @@ export class ChitRenderInstance {
|
|
|
55
53
|
|
|
56
54
|
// threejs info
|
|
57
55
|
public group = new Group(); // group storing the visible meshes. Will tween
|
|
56
|
+
protected targetAnchorPoints = new Map<OwnerOriginPosition | string, Vector3>();
|
|
58
57
|
protected anchorPoints = new Map<OwnerOriginPosition | string, Group>();
|
|
59
58
|
|
|
60
59
|
protected sizeX = 0;
|
|
@@ -337,13 +336,23 @@ export class ChitRenderInstance {
|
|
|
337
336
|
return coordinates;
|
|
338
337
|
}
|
|
339
338
|
|
|
339
|
+
public targetAnchorPoint(ownerPosition: OwnerOriginPosition | string): Vector3 {
|
|
340
|
+
let result = this.targetAnchorPoints.get(ownerPosition);
|
|
341
|
+
if (!result) {
|
|
342
|
+
result = new Vector3();
|
|
343
|
+
this.updateAnchorPosition(result, ownerPosition);
|
|
344
|
+
this.targetAnchorPoints.set(ownerPosition, result);
|
|
345
|
+
}
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
|
|
340
349
|
public anchor(ownerPosition: OwnerOriginPosition | string): Group {
|
|
341
350
|
let result = this.anchorPoints.get(ownerPosition);
|
|
342
351
|
if (!result) {
|
|
343
352
|
result = new Group();
|
|
344
|
-
this.updateGroupPosition(result, ownerPosition);
|
|
345
353
|
this.group.add(result);
|
|
346
354
|
this.anchorPoints.set(ownerPosition, result);
|
|
355
|
+
this.updateGroupPosition(ownerPosition, result);
|
|
347
356
|
}
|
|
348
357
|
return result;
|
|
349
358
|
}
|
|
@@ -352,60 +361,66 @@ export class ChitRenderInstance {
|
|
|
352
361
|
let result = this.bboxAnchorPoints.get(ownerPosition);
|
|
353
362
|
if (!result) {
|
|
354
363
|
result = new Group();
|
|
355
|
-
this.updateGroupPosition(result, ownerPosition);
|
|
356
364
|
this.bboxGroup.add(result);
|
|
357
365
|
this.bboxAnchorPoints.set(ownerPosition, result);
|
|
366
|
+
this.updateGroupPosition(ownerPosition, result);
|
|
358
367
|
}
|
|
359
368
|
return result;
|
|
360
369
|
}
|
|
361
370
|
|
|
371
|
+
protected updateGroupPosition(key: OwnerOriginPosition | string, group: Group) {
|
|
372
|
+
const vector = this.targetAnchorPoint(key);
|
|
373
|
+
group.position.set(vector.x, vector.y, vector.z + this.sizeZ / 2 + (this.renderSpec?.childrenOffsetZ ?? 0));
|
|
374
|
+
}
|
|
375
|
+
|
|
362
376
|
protected setOutletPosition(positionKey: string, position: Vector3) {
|
|
363
|
-
this.
|
|
364
|
-
this.
|
|
377
|
+
this.targetAnchorPoint(positionKey).copy(position);
|
|
378
|
+
this.updateGroupPosition(positionKey, this.anchor(positionKey));
|
|
379
|
+
this.updateGroupPosition(positionKey, this.bboxAnchor(positionKey));
|
|
365
380
|
}
|
|
366
381
|
|
|
367
|
-
protected
|
|
368
|
-
const z =
|
|
382
|
+
protected updateAnchorPosition(vector: Vector3, position: OwnerOriginPosition | string) {
|
|
383
|
+
const z = 0;
|
|
369
384
|
switch (position) {
|
|
370
385
|
case OwnerOriginPosition.TopLeft: {
|
|
371
|
-
|
|
386
|
+
vector.set(-this.sizeX / 2, this.sizeY / 2, z);
|
|
372
387
|
break;
|
|
373
388
|
}
|
|
374
389
|
case OwnerOriginPosition.TopCenter: {
|
|
375
|
-
|
|
390
|
+
vector.set(0, this.sizeY / 2, z);
|
|
376
391
|
break;
|
|
377
392
|
}
|
|
378
393
|
case OwnerOriginPosition.TopRight: {
|
|
379
|
-
|
|
394
|
+
vector.set(this.sizeX / 2, this.sizeY / 2, z);
|
|
380
395
|
break;
|
|
381
396
|
}
|
|
382
397
|
case OwnerOriginPosition.MiddleLeft: {
|
|
383
|
-
|
|
398
|
+
vector.set(-this.sizeX / 2, 0, z);
|
|
384
399
|
break;
|
|
385
400
|
}
|
|
386
401
|
case OwnerOriginPosition.MiddleCenter: {
|
|
387
|
-
|
|
402
|
+
vector.set(0, 0, z);
|
|
388
403
|
break;
|
|
389
404
|
}
|
|
390
405
|
case OwnerOriginPosition.MiddleRight: {
|
|
391
|
-
|
|
406
|
+
vector.set(this.sizeX / 2, 0, z);
|
|
392
407
|
break;
|
|
393
408
|
}
|
|
394
409
|
case OwnerOriginPosition.BottomLeft: {
|
|
395
|
-
|
|
410
|
+
vector.set(-this.sizeX / 2, -this.sizeY / 2, z);
|
|
396
411
|
break;
|
|
397
412
|
}
|
|
398
413
|
case OwnerOriginPosition.BottomCenter: {
|
|
399
|
-
|
|
414
|
+
vector.set(0, -this.sizeY / 2, z);
|
|
400
415
|
break;
|
|
401
416
|
}
|
|
402
417
|
case OwnerOriginPosition.BottomRight: {
|
|
403
|
-
|
|
418
|
+
vector.set(this.sizeX / 2, -this.sizeY / 2, z);
|
|
404
419
|
break;
|
|
405
420
|
}
|
|
406
421
|
// named strings --- they will reset the position correctly later (or not if they aren't set and then this will be correct)
|
|
407
422
|
default: {
|
|
408
|
-
|
|
423
|
+
vector.set(0, 0, z);
|
|
409
424
|
break;
|
|
410
425
|
}
|
|
411
426
|
}
|
|
@@ -418,9 +433,11 @@ export class ChitRenderInstance {
|
|
|
418
433
|
item.preferredHeight = this.renderSpec?.galleryPreferredHeight;
|
|
419
434
|
item.preferredWidth = this.renderSpec?.galleryPreferredWidth;
|
|
420
435
|
item.summary = this.renderSpec?.summary;
|
|
436
|
+
item.shortSummary = this.renderSpec?.shortSummary;
|
|
421
437
|
item.originalSummary = item.summary;
|
|
422
438
|
item.summaryIconMap = this.renderSpec?.summaryIconMap;
|
|
423
439
|
item.summaryRenderingOptions = this.renderSpec?.summaryRenderingOptions;
|
|
440
|
+
item.shortSummaryRenderingOptions = this.renderSpec?.shortSummaryRenderingOptions;
|
|
424
441
|
|
|
425
442
|
if (this._galleryItem === item) {
|
|
426
443
|
return;
|
|
@@ -539,7 +556,76 @@ export class ChitRenderInstance {
|
|
|
539
556
|
public outlineContext?: ChitRenderInstance;
|
|
540
557
|
|
|
541
558
|
public hasExplicitOnClick() {
|
|
542
|
-
return
|
|
559
|
+
return (
|
|
560
|
+
(this.chit.onClick || this.chit.onDrag || this.chit.isDropTarget) && !this.renderSpec?.isShowingChildrenAsGallery
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
public executeDrag(x: number, y: number) {
|
|
565
|
+
const root = this.rootRenderInstance;
|
|
566
|
+
const dragPoint = root.attemptToFindPlaneZ0OfCanvasPoints(x, y) ?? new Vector3(0, 0, 0);
|
|
567
|
+
const startPosition = this.group.position.clone();
|
|
568
|
+
if (!this.chit.dropTargets) {
|
|
569
|
+
throw "Must have drop targets";
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const startWorldPosition = this.bboxGroup.getWorldPosition(new Vector3());
|
|
573
|
+
const targets: { chit: Chit; distance: Vector3 }[] = [];
|
|
574
|
+
this.chit.dropTargets.map((target) => {
|
|
575
|
+
if (target.renderInstance && target !== this.chit) {
|
|
576
|
+
const position = target.renderInstance.bboxGroup.getWorldPosition(new Vector3());
|
|
577
|
+
targets.push({ chit: target, distance: position.sub(startWorldPosition) });
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
let dropTarget: Chit | undefined = undefined;
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
duringDrag: (dx: number, dy: number) => {
|
|
584
|
+
x += dx;
|
|
585
|
+
y += dy;
|
|
586
|
+
const currentPoint = root.attemptToFindPlaneZ0OfCanvasPoints(x, y) ?? new Vector3(0, 0, 0);
|
|
587
|
+
const worldDx = currentPoint.x - dragPoint.x;
|
|
588
|
+
const worldDy = currentPoint.y - dragPoint.y;
|
|
589
|
+
this.group.position.set(
|
|
590
|
+
startPosition.x + worldDx,
|
|
591
|
+
startPosition.y + worldDy,
|
|
592
|
+
startPosition.z + (this.renderSpec?.dragZLiftAmount ?? 0),
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
let closestIndex = 0;
|
|
596
|
+
let closest = Number.MAX_SAFE_INTEGER;
|
|
597
|
+
targets.forEach(({ distance }, i) => {
|
|
598
|
+
const computed = Math.sqrt(
|
|
599
|
+
(worldDx - distance.x) * (worldDx - distance.x) + (worldDy - distance.y) * (worldDy - distance.y),
|
|
600
|
+
);
|
|
601
|
+
if (computed < closest) {
|
|
602
|
+
closest = computed;
|
|
603
|
+
closestIndex = i;
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
if (dropTarget && dropTarget !== targets[closestIndex].chit) {
|
|
608
|
+
dropTarget.isDropTarget = false;
|
|
609
|
+
dropTarget.renderInstance?.refresh();
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
dropTarget = targets[closestIndex].chit;
|
|
613
|
+
dropTarget.isDropTarget = true;
|
|
614
|
+
dropTarget.renderInstance!.refresh();
|
|
615
|
+
|
|
616
|
+
root.markDirty();
|
|
617
|
+
},
|
|
618
|
+
finishDrag: () => {
|
|
619
|
+
if (dropTarget) {
|
|
620
|
+
dropTarget.isDropTarget = false;
|
|
621
|
+
dropTarget.renderInstance?.refresh();
|
|
622
|
+
|
|
623
|
+
this.chit.onDrag!(dropTarget);
|
|
624
|
+
dropTarget.add(this.chit);
|
|
625
|
+
}
|
|
626
|
+
this.refresh();
|
|
627
|
+
},
|
|
628
|
+
};
|
|
543
629
|
}
|
|
544
630
|
|
|
545
631
|
public fixOutline() {
|
|
@@ -611,39 +697,11 @@ export class ChitRenderInstance {
|
|
|
611
697
|
|
|
612
698
|
const screenCoordsOfNewLocation =
|
|
613
699
|
chit instanceof Vector2 ? chit : chit ? chit.screenCoordinates() : new Vector2(0, 0);
|
|
614
|
-
if (
|
|
615
|
-
|
|
616
|
-
const cameraSpace = rootRenderInstance.convertScreenSpaceToCameraSpace(
|
|
700
|
+
if (screenCoordsOfNewLocation) {
|
|
701
|
+
return rootRenderInstance.attemptToFindPlaneZ0OfScreenPoints(
|
|
617
702
|
screenCoordsOfNewLocation.x,
|
|
618
703
|
screenCoordsOfNewLocation.y,
|
|
619
704
|
);
|
|
620
|
-
|
|
621
|
-
if (!cameraSpace) {
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
const scale = Math.max(Math.abs(cameraSpace.x), Math.abs(cameraSpace.y));
|
|
626
|
-
if (!Number.isFinite(scale) || scale === 0) {
|
|
627
|
-
return undefined;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
let multiplier = scale > 1 ? 1 : 1 / scale;
|
|
631
|
-
|
|
632
|
-
// figure out what camera space means at Z=0
|
|
633
|
-
for (; multiplier > 0.11; multiplier *= 0.75) {
|
|
634
|
-
const raycaster = new Raycaster();
|
|
635
|
-
raycaster.setFromCamera(
|
|
636
|
-
new Vector2(cameraSpace.x * multiplier, cameraSpace.y * multiplier),
|
|
637
|
-
rootRenderInstance.camera,
|
|
638
|
-
);
|
|
639
|
-
const planeZ = new Plane(new Vector3(0, 0, 1), 0);
|
|
640
|
-
const intersection = new Vector3();
|
|
641
|
-
const intersects = raycaster.ray.intersectPlane(planeZ, intersection);
|
|
642
|
-
if (intersects) {
|
|
643
|
-
return intersects;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
// return intersection;
|
|
647
705
|
}
|
|
648
706
|
}
|
|
649
707
|
|
|
@@ -729,7 +787,7 @@ export class ChitRenderInstance {
|
|
|
729
787
|
if (this.isUsingSyntheticBbox) {
|
|
730
788
|
if (!this._boundingBoxDirty) {
|
|
731
789
|
this._boundingBoxDirty = true;
|
|
732
|
-
|
|
790
|
+
queueMicrotask(() => {
|
|
733
791
|
this.updateBoundingBox();
|
|
734
792
|
this._boundingBoxDirty = false;
|
|
735
793
|
});
|
|
@@ -799,6 +857,10 @@ export class ChitRenderInstance {
|
|
|
799
857
|
this.centerY = this.sizeY / 2 + box3.min.y;
|
|
800
858
|
this.centerZ = this.sizeZ / 2 + box3.min.z;
|
|
801
859
|
|
|
860
|
+
Object.entries(this.renderSpec.outletPositions).forEach(([key, position]) => {
|
|
861
|
+
this.targetAnchorPoint(key).copy(new Vector3(position.x, position.y, position.z));
|
|
862
|
+
});
|
|
863
|
+
|
|
802
864
|
const newKey = this.positionKey(clickBox3);
|
|
803
865
|
const keyChanged = newKey !== this._lastUpdateBoudingBoxKey;
|
|
804
866
|
if (keyChanged) {
|
|
@@ -810,9 +872,6 @@ export class ChitRenderInstance {
|
|
|
810
872
|
clickBox3.max.z - clickBox3.min.z,
|
|
811
873
|
);
|
|
812
874
|
|
|
813
|
-
[...this.anchorPoints.entries()].forEach(([key, value]) => this.updateGroupPosition(value, key));
|
|
814
|
-
[...this.bboxAnchorPoints.entries()].forEach(([key, value]) => this.updateGroupPosition(value, key));
|
|
815
|
-
|
|
816
875
|
this.fixObjectPosition();
|
|
817
876
|
this.bbox.position.z = this.centerZ;
|
|
818
877
|
this.bbox.position.x = this.centerX;
|
|
@@ -833,9 +892,8 @@ export class ChitRenderInstance {
|
|
|
833
892
|
this.bboxGroup.rotation.order = "ZYX";
|
|
834
893
|
this.bboxGroup.rotation.set(this.renderSpec.rotateX, this.renderSpec.rotateY, this.renderSpec.rotateZ);
|
|
835
894
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
});
|
|
895
|
+
[...this.anchorPoints.entries()].forEach(([key, value]) => this.updateGroupPosition(key, value));
|
|
896
|
+
[...this.bboxAnchorPoints.entries()].forEach(([key, value]) => this.updateGroupPosition(key, value));
|
|
839
897
|
|
|
840
898
|
if (keyChanged) {
|
|
841
899
|
this.notifyBoundingBoxChanged();
|
|
@@ -58,8 +58,12 @@ export class ChitRenderSpec {
|
|
|
58
58
|
public splay = new Splay();
|
|
59
59
|
|
|
60
60
|
public summary: string | undefined;
|
|
61
|
+
public shortSummary: string | undefined;
|
|
61
62
|
public summaryIconMap: IconMap | undefined;
|
|
62
63
|
public summaryRenderingOptions: RichTextRenderOptionsParameters | undefined;
|
|
64
|
+
public shortSummaryRenderingOptions: RichTextRenderOptionsParameters | undefined;
|
|
65
|
+
|
|
66
|
+
public dragZLiftAmount: number = 1;
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
69
|
* The active player that is playing this match
|