@pretty-chitty/core 1.1.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/LICENSE.md +51 -0
- package/README.md +152 -0
- package/dist/0e0a96423fd742218c61.woff2 +0 -0
- package/dist/1e28c9f184923aacc181.woff +0 -0
- package/dist/37f3b2ddcbe588b2aaa5.jpg +0 -0
- package/dist/3f0fb9058a03e14ad2fa.jpg +0 -0
- package/dist/4482e08504d544757971.woff2 +0 -0
- package/dist/5212361bfd059a27e2da.woff2 +0 -0
- package/dist/699b459f21e39ca4b8df.woff2 +0 -0
- package/dist/7e339dfbea59fe54f2e3.png +0 -0
- package/dist/a3e6d4ebd8f859f0f1dc.woff +0 -0
- package/dist/b8b0d3bc0d26444e4a5a.woff2 +0 -0
- package/dist/bce9a6fcc5b3da9a086a.woff +0 -0
- package/dist/components/ActionLogDisplay.d.ts +4 -0
- package/dist/components/ActionLogDisplay.d.ts.map +1 -0
- package/dist/components/ActionLogDisplay.js +144 -0
- package/dist/components/ActionLogDisplay.js.map +1 -0
- package/dist/components/ActionLogHistory.d.ts +6 -0
- package/dist/components/ActionLogHistory.d.ts.map +1 -0
- package/dist/components/ActionLogHistory.js +81 -0
- package/dist/components/ActionLogHistory.js.map +1 -0
- package/dist/components/ActionLogHistoryDisplay.d.ts +2 -0
- package/dist/components/ActionLogHistoryDisplay.d.ts.map +1 -0
- package/dist/components/ActionLogHistoryDisplay.js +17 -0
- package/dist/components/ActionLogHistoryDisplay.js.map +1 -0
- package/dist/components/ActionLogSidebar.d.ts +2 -0
- package/dist/components/ActionLogSidebar.d.ts.map +1 -0
- package/dist/components/ActionLogSidebar.js +9 -0
- package/dist/components/ActionLogSidebar.js.map +1 -0
- package/dist/components/BottomBar.d.ts +2 -0
- package/dist/components/BottomBar.d.ts.map +1 -0
- package/dist/components/BottomBar.js +33 -0
- package/dist/components/BottomBar.js.map +1 -0
- package/dist/components/BottomBarBreak.d.ts +2 -0
- package/dist/components/BottomBarBreak.d.ts.map +1 -0
- package/dist/components/BottomBarBreak.js +8 -0
- package/dist/components/BottomBarBreak.js.map +1 -0
- package/dist/components/BottomBarButton.d.ts +16 -0
- package/dist/components/BottomBarButton.d.ts.map +1 -0
- package/dist/components/BottomBarButton.js +123 -0
- package/dist/components/BottomBarButton.js.map +1 -0
- package/dist/components/CanvasLibraryViewer.d.ts +8 -0
- package/dist/components/CanvasLibraryViewer.d.ts.map +1 -0
- package/dist/components/CanvasLibraryViewer.js +29 -0
- package/dist/components/CanvasLibraryViewer.js.map +1 -0
- package/dist/components/ChitLibraryViewer.d.ts +8 -0
- package/dist/components/ChitLibraryViewer.d.ts.map +1 -0
- package/dist/components/ChitLibraryViewer.js +101 -0
- package/dist/components/ChitLibraryViewer.js.map +1 -0
- package/dist/components/ClientTrustMatchViewer.d.ts +11 -0
- package/dist/components/ClientTrustMatchViewer.d.ts.map +1 -0
- package/dist/components/ClientTrustMatchViewer.js +53 -0
- package/dist/components/ClientTrustMatchViewer.js.map +1 -0
- package/dist/components/ContextGalleryDisplay.d.ts +4 -0
- package/dist/components/ContextGalleryDisplay.d.ts.map +1 -0
- package/dist/components/ContextGalleryDisplay.js +49 -0
- package/dist/components/ContextGalleryDisplay.js.map +1 -0
- package/dist/components/GalleryDisplay.d.ts +2 -0
- package/dist/components/GalleryDisplay.d.ts.map +1 -0
- package/dist/components/GalleryDisplay.js +42 -0
- package/dist/components/GalleryDisplay.js.map +1 -0
- package/dist/components/GalleryPlayground.d.ts +14 -0
- package/dist/components/GalleryPlayground.d.ts.map +1 -0
- package/dist/components/GalleryPlayground.js +36 -0
- package/dist/components/GalleryPlayground.js.map +1 -0
- package/dist/components/GalleryViewer.d.ts +48 -0
- package/dist/components/GalleryViewer.d.ts.map +1 -0
- package/dist/components/GalleryViewer.js +567 -0
- package/dist/components/GalleryViewer.js.map +1 -0
- package/dist/components/GameDesigner.d.ts +5 -0
- package/dist/components/GameDesigner.d.ts.map +1 -0
- package/dist/components/GameDesigner.js +14 -0
- package/dist/components/GameDesigner.js.map +1 -0
- package/dist/components/GameDialog.d.ts +7 -0
- package/dist/components/GameDialog.d.ts.map +1 -0
- package/dist/components/GameDialog.js +24 -0
- package/dist/components/GameDialog.js.map +1 -0
- package/dist/components/GameModalBackdrop.d.ts +10 -0
- package/dist/components/GameModalBackdrop.d.ts.map +1 -0
- package/dist/components/GameModalBackdrop.js +33 -0
- package/dist/components/GameModalBackdrop.js.map +1 -0
- package/dist/components/GameModalDialog.d.ts +11 -0
- package/dist/components/GameModalDialog.d.ts.map +1 -0
- package/dist/components/GameModalDialog.js +42 -0
- package/dist/components/GameModalDialog.js.map +1 -0
- package/dist/components/LiveButton.d.ts +4 -0
- package/dist/components/LiveButton.d.ts.map +1 -0
- package/dist/components/LiveButton.js +17 -0
- package/dist/components/LiveButton.js.map +1 -0
- package/dist/components/MatchEndDisplay.d.ts +2 -0
- package/dist/components/MatchEndDisplay.d.ts.map +1 -0
- package/dist/components/MatchEndDisplay.js +67 -0
- package/dist/components/MatchEndDisplay.js.map +1 -0
- package/dist/components/MatchViewer.d.ts +5 -0
- package/dist/components/MatchViewer.d.ts.map +1 -0
- package/dist/components/MatchViewer.js +59 -0
- package/dist/components/MatchViewer.js.map +1 -0
- package/dist/components/ObjectWithPropsEditor.d.ts +5 -0
- package/dist/components/ObjectWithPropsEditor.d.ts.map +1 -0
- package/dist/components/ObjectWithPropsEditor.js +88 -0
- package/dist/components/ObjectWithPropsEditor.js.map +1 -0
- package/dist/components/Panel/MultiPanel.d.ts +13 -0
- package/dist/components/Panel/MultiPanel.d.ts.map +1 -0
- package/dist/components/Panel/MultiPanel.js +196 -0
- package/dist/components/Panel/MultiPanel.js.map +1 -0
- package/dist/components/Panel/PanelContents.d.ts +27 -0
- package/dist/components/Panel/PanelContents.d.ts.map +1 -0
- package/dist/components/Panel/PanelContents.js +202 -0
- package/dist/components/Panel/PanelContents.js.map +1 -0
- package/dist/components/Panel/PanelTabStack.d.ts +9 -0
- package/dist/components/Panel/PanelTabStack.d.ts.map +1 -0
- package/dist/components/Panel/PanelTabStack.js +56 -0
- package/dist/components/Panel/PanelTabStack.js.map +1 -0
- package/dist/components/Panel/SinglePanel.d.ts +13 -0
- package/dist/components/Panel/SinglePanel.d.ts.map +1 -0
- package/dist/components/Panel/SinglePanel.js +44 -0
- package/dist/components/Panel/SinglePanel.js.map +1 -0
- package/dist/components/Panel/ViewerWrapper.d.ts +17 -0
- package/dist/components/Panel/ViewerWrapper.d.ts.map +1 -0
- package/dist/components/Panel/ViewerWrapper.js +70 -0
- package/dist/components/Panel/ViewerWrapper.js.map +1 -0
- package/dist/components/Panel/ViewerZoomControls.d.ts +8 -0
- package/dist/components/Panel/ViewerZoomControls.d.ts.map +1 -0
- package/dist/components/Panel/ViewerZoomControls.js +152 -0
- package/dist/components/Panel/ViewerZoomControls.js.map +1 -0
- package/dist/components/Panel/util.d.ts +3 -0
- package/dist/components/Panel/util.d.ts.map +1 -0
- package/dist/components/Panel/util.js +5 -0
- package/dist/components/Panel/util.js.map +1 -0
- package/dist/components/PanelSpark.d.ts +7 -0
- package/dist/components/PanelSpark.d.ts.map +1 -0
- package/dist/components/PanelSpark.js +84 -0
- package/dist/components/PanelSpark.js.map +1 -0
- package/dist/components/PersistentCanvas.d.ts +12 -0
- package/dist/components/PersistentCanvas.d.ts.map +1 -0
- package/dist/components/PersistentCanvas.js +44 -0
- package/dist/components/PersistentCanvas.js.map +1 -0
- package/dist/components/PlayerImage.d.ts +9 -0
- package/dist/components/PlayerImage.d.ts.map +1 -0
- package/dist/components/PlayerImage.js +21 -0
- package/dist/components/PlayerImage.js.map +1 -0
- package/dist/components/Playground.d.ts +9 -0
- package/dist/components/Playground.d.ts.map +1 -0
- package/dist/components/Playground.js +129 -0
- package/dist/components/Playground.js.map +1 -0
- package/dist/components/PromptControls.d.ts +4 -0
- package/dist/components/PromptControls.d.ts.map +1 -0
- package/dist/components/PromptControls.js +87 -0
- package/dist/components/PromptControls.js.map +1 -0
- package/dist/components/SelectableItemAndStage.d.ts +8 -0
- package/dist/components/SelectableItemAndStage.d.ts.map +1 -0
- package/dist/components/SelectableItemAndStage.js +16 -0
- package/dist/components/SelectableItemAndStage.js.map +1 -0
- package/dist/components/SettingsDisplay.d.ts +2 -0
- package/dist/components/SettingsDisplay.d.ts.map +1 -0
- package/dist/components/SettingsDisplay.js +62 -0
- package/dist/components/SettingsDisplay.js.map +1 -0
- package/dist/components/SparkLineChart.d.ts +21 -0
- package/dist/components/SparkLineChart.d.ts.map +1 -0
- package/dist/components/SparkLineChart.js +143 -0
- package/dist/components/SparkLineChart.js.map +1 -0
- package/dist/components/StageAndEditor.d.ts +5 -0
- package/dist/components/StageAndEditor.d.ts.map +1 -0
- package/dist/components/StageAndEditor.js +12 -0
- package/dist/components/StageAndEditor.js.map +1 -0
- package/dist/components/TimeControlBar.d.ts +5 -0
- package/dist/components/TimeControlBar.d.ts.map +1 -0
- package/dist/components/TimeControlBar.js +38 -0
- package/dist/components/TimeControlBar.js.map +1 -0
- package/dist/components/TokenizedMessage.d.ts +13 -0
- package/dist/components/TokenizedMessage.d.ts.map +1 -0
- package/dist/components/TokenizedMessage.js +102 -0
- package/dist/components/TokenizedMessage.js.map +1 -0
- package/dist/components/TopBar.d.ts +4 -0
- package/dist/components/TopBar.d.ts.map +1 -0
- package/dist/components/TopBar.js +47 -0
- package/dist/components/TopBar.js.map +1 -0
- package/dist/components/TopBarDropdown.d.ts +6 -0
- package/dist/components/TopBarDropdown.d.ts.map +1 -0
- package/dist/components/TopBarDropdown.js +69 -0
- package/dist/components/TopBarDropdown.js.map +1 -0
- package/dist/components/TopBarPlayers.d.ts +2 -0
- package/dist/components/TopBarPlayers.d.ts.map +1 -0
- package/dist/components/TopBarPlayers.js +70 -0
- package/dist/components/TopBarPlayers.js.map +1 -0
- package/dist/components/UpdatingCanvasImage.d.ts +7 -0
- package/dist/components/UpdatingCanvasImage.d.ts.map +1 -0
- package/dist/components/UpdatingCanvasImage.js +22 -0
- package/dist/components/UpdatingCanvasImage.js.map +1 -0
- package/dist/components/UpdatingCanvasViewer.d.ts +7 -0
- package/dist/components/UpdatingCanvasViewer.d.ts.map +1 -0
- package/dist/components/UpdatingCanvasViewer.js +50 -0
- package/dist/components/UpdatingCanvasViewer.js.map +1 -0
- package/dist/components/Viewer.d.ts +16 -0
- package/dist/components/Viewer.d.ts.map +1 -0
- package/dist/components/Viewer.js +289 -0
- package/dist/components/Viewer.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/e085acb5e467d8e85d21.woff +0 -0
- package/dist/e65dff62134b8879e792.woff +0 -0
- package/dist/game/Chit.d.ts +64 -0
- package/dist/game/Chit.d.ts.map +1 -0
- package/dist/game/Chit.js +524 -0
- package/dist/game/Chit.js.map +1 -0
- package/dist/game/ClientTimeState.d.ts +16 -0
- package/dist/game/ClientTimeState.d.ts.map +1 -0
- package/dist/game/ClientTimeState.js +38 -0
- package/dist/game/ClientTimeState.js.map +1 -0
- package/dist/game/ClockDetails.d.ts +9 -0
- package/dist/game/ClockDetails.d.ts.map +1 -0
- package/dist/game/ClockDetails.js +19 -0
- package/dist/game/ClockDetails.js.map +1 -0
- package/dist/game/Connection.d.ts +26 -0
- package/dist/game/Connection.d.ts.map +1 -0
- package/dist/game/Connection.js +99 -0
- package/dist/game/Connection.js.map +1 -0
- package/dist/game/ConnectionObject.d.ts +7 -0
- package/dist/game/ConnectionObject.d.ts.map +1 -0
- package/dist/game/ConnectionObject.js +16 -0
- package/dist/game/ConnectionObject.js.map +1 -0
- package/dist/game/ConnectionTransport.d.ts +17 -0
- package/dist/game/ConnectionTransport.d.ts.map +1 -0
- package/dist/game/ConnectionTransport.js +39 -0
- package/dist/game/ConnectionTransport.js.map +1 -0
- package/dist/game/DropdownChit.d.ts +7 -0
- package/dist/game/DropdownChit.d.ts.map +1 -0
- package/dist/game/DropdownChit.js +29 -0
- package/dist/game/DropdownChit.js.map +1 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts +12 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts.map +1 -0
- package/dist/game/GalleryItemChitChildrenSource.js +25 -0
- package/dist/game/GalleryItemChitChildrenSource.js.map +1 -0
- package/dist/game/GalleryItemRawSource.d.ts +9 -0
- package/dist/game/GalleryItemRawSource.d.ts.map +1 -0
- package/dist/game/GalleryItemRawSource.js +13 -0
- package/dist/game/GalleryItemRawSource.js.map +1 -0
- package/dist/game/Game.d.ts +51 -0
- package/dist/game/Game.d.ts.map +1 -0
- package/dist/game/Game.js +2 -0
- package/dist/game/Game.js.map +1 -0
- package/dist/game/GameBagChit.d.ts +16 -0
- package/dist/game/GameBagChit.d.ts.map +1 -0
- package/dist/game/GameBagChit.js +51 -0
- package/dist/game/GameBagChit.js.map +1 -0
- package/dist/game/GameButton.d.ts +30 -0
- package/dist/game/GameButton.d.ts.map +1 -0
- package/dist/game/GameButton.js +115 -0
- package/dist/game/GameButton.js.map +1 -0
- package/dist/game/GameDeckChit.d.ts +23 -0
- package/dist/game/GameDeckChit.d.ts.map +1 -0
- package/dist/game/GameDeckChit.js +79 -0
- package/dist/game/GameDeckChit.js.map +1 -0
- package/dist/game/GameTheme.d.ts +75 -0
- package/dist/game/GameTheme.d.ts.map +1 -0
- package/dist/game/GameTheme.js +103 -0
- package/dist/game/GameTheme.js.map +1 -0
- package/dist/game/Match.d.ts +34 -0
- package/dist/game/Match.d.ts.map +1 -0
- package/dist/game/Match.js +151 -0
- package/dist/game/Match.js.map +1 -0
- package/dist/game/MatchConnection.d.ts +8 -0
- package/dist/game/MatchConnection.d.ts.map +1 -0
- package/dist/game/MatchConnection.js +6 -0
- package/dist/game/MatchConnection.js.map +1 -0
- package/dist/game/MatchStorage.d.ts +17 -0
- package/dist/game/MatchStorage.d.ts.map +1 -0
- package/dist/game/MatchStorage.js +32 -0
- package/dist/game/MatchStorage.js.map +1 -0
- package/dist/game/ModalState.d.ts +9 -0
- package/dist/game/ModalState.d.ts.map +1 -0
- package/dist/game/ModalState.js +27 -0
- package/dist/game/ModalState.js.map +1 -0
- package/dist/game/OrderedOutlet.d.ts +50 -0
- package/dist/game/OrderedOutlet.d.ts.map +1 -0
- package/dist/game/OrderedOutlet.js +164 -0
- package/dist/game/OrderedOutlet.js.map +1 -0
- package/dist/game/Pick.d.ts +26 -0
- package/dist/game/Pick.d.ts.map +1 -0
- package/dist/game/Pick.js +239 -0
- package/dist/game/Pick.js.map +1 -0
- package/dist/game/PlayerChit.d.ts +16 -0
- package/dist/game/PlayerChit.d.ts.map +1 -0
- package/dist/game/PlayerChit.js +56 -0
- package/dist/game/PlayerChit.js.map +1 -0
- package/dist/game/PlayerInfo.d.ts +12 -0
- package/dist/game/PlayerInfo.d.ts.map +1 -0
- package/dist/game/PlayerInfo.js +20 -0
- package/dist/game/PlayerInfo.js.map +1 -0
- package/dist/game/PlayerPromptStatusChit.d.ts +5 -0
- package/dist/game/PlayerPromptStatusChit.d.ts.map +1 -0
- package/dist/game/PlayerPromptStatusChit.js +35 -0
- package/dist/game/PlayerPromptStatusChit.js.map +1 -0
- package/dist/game/Prompt.d.ts +94 -0
- package/dist/game/Prompt.d.ts.map +1 -0
- package/dist/game/Prompt.js +229 -0
- package/dist/game/Prompt.js.map +1 -0
- package/dist/game/RootChit.d.ts +15 -0
- package/dist/game/RootChit.d.ts.map +1 -0
- package/dist/game/RootChit.js +62 -0
- package/dist/game/RootChit.js.map +1 -0
- package/dist/game/SparkChit.d.ts +27 -0
- package/dist/game/SparkChit.d.ts.map +1 -0
- package/dist/game/SparkChit.js +97 -0
- package/dist/game/SparkChit.js.map +1 -0
- package/dist/game/StaticChitTypeRegistry.d.ts +5 -0
- package/dist/game/StaticChitTypeRegistry.d.ts.map +1 -0
- package/dist/game/StaticChitTypeRegistry.js +3 -0
- package/dist/game/StaticChitTypeRegistry.js.map +1 -0
- package/dist/game/Turn.d.ts +169 -0
- package/dist/game/Turn.d.ts.map +1 -0
- package/dist/game/Turn.js +1031 -0
- package/dist/game/Turn.js.map +1 -0
- package/dist/game/TurnState.d.ts +30 -0
- package/dist/game/TurnState.d.ts.map +1 -0
- package/dist/game/TurnState.js +170 -0
- package/dist/game/TurnState.js.map +1 -0
- package/dist/game/clientTransport/ClientPrompts.d.ts +23 -0
- package/dist/game/clientTransport/ClientPrompts.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientPrompts.js +85 -0
- package/dist/game/clientTransport/ClientPrompts.js.map +1 -0
- package/dist/game/clientTransport/ClientStatus.d.ts +19 -0
- package/dist/game/clientTransport/ClientStatus.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientStatus.js +25 -0
- package/dist/game/clientTransport/ClientStatus.js.map +1 -0
- package/dist/game/clientTransport/ClientTime.d.ts +42 -0
- package/dist/game/clientTransport/ClientTime.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientTime.js +197 -0
- package/dist/game/clientTransport/ClientTime.js.map +1 -0
- package/dist/game/index.d.ts +1 -0
- package/dist/game/index.d.ts.map +1 -0
- package/dist/game/index.js +2 -0
- package/dist/game/index.js.map +1 -0
- package/dist/game/serverTransport/ServerPrompts.d.ts +17 -0
- package/dist/game/serverTransport/ServerPrompts.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerPrompts.js +51 -0
- package/dist/game/serverTransport/ServerPrompts.js.map +1 -0
- package/dist/game/serverTransport/ServerStatus.d.ts +12 -0
- package/dist/game/serverTransport/ServerStatus.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerStatus.js +16 -0
- package/dist/game/serverTransport/ServerStatus.js.map +1 -0
- package/dist/game/serverTransport/ServerTime.d.ts +39 -0
- package/dist/game/serverTransport/ServerTime.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerTime.js +57 -0
- package/dist/game/serverTransport/ServerTime.js.map +1 -0
- package/dist/hooks/useChits.d.ts +4 -0
- package/dist/hooks/useChits.d.ts.map +1 -0
- package/dist/hooks/useChits.js +24 -0
- package/dist/hooks/useChits.js.map +1 -0
- package/dist/hooks/useConnection.d.ts +8 -0
- package/dist/hooks/useConnection.d.ts.map +1 -0
- package/dist/hooks/useConnection.js +14 -0
- package/dist/hooks/useConnection.js.map +1 -0
- package/dist/hooks/useEventChannelState.d.ts +4 -0
- package/dist/hooks/useEventChannelState.d.ts.map +1 -0
- package/dist/hooks/useEventChannelState.js +25 -0
- package/dist/hooks/useEventChannelState.js.map +1 -0
- package/dist/hooks/useGame.d.ts +8 -0
- package/dist/hooks/useGame.d.ts.map +1 -0
- package/dist/hooks/useGame.js +14 -0
- package/dist/hooks/useGame.js.map +1 -0
- package/dist/hooks/useGameTheme.d.ts +8 -0
- package/dist/hooks/useGameTheme.d.ts.map +1 -0
- package/dist/hooks/useGameTheme.js +11 -0
- package/dist/hooks/useGameTheme.js.map +1 -0
- package/dist/hooks/useModalState.d.ts +7 -0
- package/dist/hooks/useModalState.d.ts.map +1 -0
- package/dist/hooks/useModalState.js +12 -0
- package/dist/hooks/useModalState.js.map +1 -0
- package/dist/hooks/usePanelPositioning.d.ts +22 -0
- package/dist/hooks/usePanelPositioning.d.ts.map +1 -0
- package/dist/hooks/usePanelPositioning.js +10 -0
- package/dist/hooks/usePanelPositioning.js.map +1 -0
- package/dist/hooks/usePanelScale.d.ts +7 -0
- package/dist/hooks/usePanelScale.d.ts.map +1 -0
- package/dist/hooks/usePanelScale.js +22 -0
- package/dist/hooks/usePanelScale.js.map +1 -0
- package/dist/hooks/usePanelStates.d.ts +9 -0
- package/dist/hooks/usePanelStates.d.ts.map +1 -0
- package/dist/hooks/usePanelStates.js +19 -0
- package/dist/hooks/usePanelStates.js.map +1 -0
- package/dist/hooks/usePlayer.d.ts +7 -0
- package/dist/hooks/usePlayer.d.ts.map +1 -0
- package/dist/hooks/usePlayer.js +14 -0
- package/dist/hooks/usePlayer.js.map +1 -0
- package/dist/hooks/useSmartDebouncedState.d.ts +27 -0
- package/dist/hooks/useSmartDebouncedState.d.ts.map +1 -0
- package/dist/hooks/useSmartDebouncedState.js +109 -0
- package/dist/hooks/useSmartDebouncedState.js.map +1 -0
- package/dist/hooks/useTimeController.d.ts +22 -0
- package/dist/hooks/useTimeController.d.ts.map +1 -0
- package/dist/hooks/useTimeController.js +89 -0
- package/dist/hooks/useTimeController.js.map +1 -0
- package/dist/hooks/useTokenMap.d.ts +5 -0
- package/dist/hooks/useTokenMap.d.ts.map +1 -0
- package/dist/hooks/useTokenMap.js +16 -0
- package/dist/hooks/useTokenMap.js.map +1 -0
- package/dist/hooks/useWebGlRenderer.d.ts +34 -0
- package/dist/hooks/useWebGlRenderer.d.ts.map +1 -0
- package/dist/hooks/useWebGlRenderer.js +167 -0
- package/dist/hooks/useWebGlRenderer.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +12 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/pretty-chitty.js +190767 -0
- package/dist/pretty-chitty.js.map +1 -0
- package/dist/rendering/CameraSpec.d.ts +22 -0
- package/dist/rendering/CameraSpec.d.ts.map +1 -0
- package/dist/rendering/CameraSpec.js +25 -0
- package/dist/rendering/CameraSpec.js.map +1 -0
- package/dist/rendering/CameraWrapperPerspective.d.ts +44 -0
- package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -0
- package/dist/rendering/CameraWrapperPerspective.js +481 -0
- package/dist/rendering/CameraWrapperPerspective.js.map +1 -0
- package/dist/rendering/ChitGalleryItemInstance.d.ts +31 -0
- package/dist/rendering/ChitGalleryItemInstance.d.ts.map +1 -0
- package/dist/rendering/ChitGalleryItemInstance.js +75 -0
- package/dist/rendering/ChitGalleryItemInstance.js.map +1 -0
- package/dist/rendering/ChitRenderInstance.d.ts +104 -0
- package/dist/rendering/ChitRenderInstance.d.ts.map +1 -0
- package/dist/rendering/ChitRenderInstance.js +902 -0
- package/dist/rendering/ChitRenderInstance.js.map +1 -0
- package/dist/rendering/ChitRenderSpec.d.ts +80 -0
- package/dist/rendering/ChitRenderSpec.d.ts.map +1 -0
- package/dist/rendering/ChitRenderSpec.js +152 -0
- package/dist/rendering/ChitRenderSpec.js.map +1 -0
- package/dist/rendering/HighlightSpec.d.ts +6 -0
- package/dist/rendering/HighlightSpec.d.ts.map +1 -0
- package/dist/rendering/HighlightSpec.js +6 -0
- package/dist/rendering/HighlightSpec.js.map +1 -0
- package/dist/rendering/LightSpec.d.ts +17 -0
- package/dist/rendering/LightSpec.d.ts.map +1 -0
- package/dist/rendering/LightSpec.js +37 -0
- package/dist/rendering/LightSpec.js.map +1 -0
- package/dist/rendering/LightWrapper.d.ts +19 -0
- package/dist/rendering/LightWrapper.d.ts.map +1 -0
- package/dist/rendering/LightWrapper.js +114 -0
- package/dist/rendering/LightWrapper.js.map +1 -0
- package/dist/rendering/RootChitRenderInstance.d.ts +81 -0
- package/dist/rendering/RootChitRenderInstance.d.ts.map +1 -0
- package/dist/rendering/RootChitRenderInstance.js +372 -0
- package/dist/rendering/RootChitRenderInstance.js.map +1 -0
- package/dist/rendering/Splay.d.ts +23 -0
- package/dist/rendering/Splay.d.ts.map +1 -0
- package/dist/rendering/Splay.js +89 -0
- package/dist/rendering/Splay.js.map +1 -0
- package/dist/rendering/SplayCounter.d.ts +19 -0
- package/dist/rendering/SplayCounter.d.ts.map +1 -0
- package/dist/rendering/SplayCounter.js +18 -0
- package/dist/rendering/SplayCounter.js.map +1 -0
- package/dist/rendering/TextureReferenceCounter.d.ts +12 -0
- package/dist/rendering/TextureReferenceCounter.d.ts.map +1 -0
- package/dist/rendering/TextureReferenceCounter.js +76 -0
- package/dist/rendering/TextureReferenceCounter.js.map +1 -0
- package/dist/rendering/index.d.ts +1 -0
- package/dist/rendering/index.d.ts.map +1 -0
- package/dist/rendering/index.js +2 -0
- package/dist/rendering/index.js.map +1 -0
- package/dist/rendering/outline/DepthVisualizationPass.d.ts +12 -0
- package/dist/rendering/outline/DepthVisualizationPass.d.ts.map +1 -0
- package/dist/rendering/outline/DepthVisualizationPass.js +93 -0
- package/dist/rendering/outline/DepthVisualizationPass.js.map +1 -0
- package/dist/rendering/outline/EffectComposer.d.ts +24 -0
- package/dist/rendering/outline/EffectComposer.d.ts.map +1 -0
- package/dist/rendering/outline/EffectComposer.js +118 -0
- package/dist/rendering/outline/EffectComposer.js.map +1 -0
- package/dist/rendering/outline/FullScreenQuad.d.ts +12 -0
- package/dist/rendering/outline/FullScreenQuad.d.ts.map +1 -0
- package/dist/rendering/outline/FullScreenQuad.js +21 -0
- package/dist/rendering/outline/FullScreenQuad.js.map +1 -0
- package/dist/rendering/outline/IDBasedOutlinePass.d.ts +49 -0
- package/dist/rendering/outline/IDBasedOutlinePass.d.ts.map +1 -0
- package/dist/rendering/outline/IDBasedOutlinePass.js +597 -0
- package/dist/rendering/outline/IDBasedOutlinePass.js.map +1 -0
- package/dist/rendering/outline/OutputPass.d.ts +13 -0
- package/dist/rendering/outline/OutputPass.d.ts.map +1 -0
- package/dist/rendering/outline/OutputPass.js +57 -0
- package/dist/rendering/outline/OutputPass.js.map +1 -0
- package/dist/rendering/outline/RenderPass.d.ts +13 -0
- package/dist/rendering/outline/RenderPass.d.ts.map +1 -0
- package/dist/rendering/outline/RenderPass.js +54 -0
- package/dist/rendering/outline/RenderPass.js.map +1 -0
- package/dist/rendering/outline/SceneWrapper.d.ts +39 -0
- package/dist/rendering/outline/SceneWrapper.d.ts.map +1 -0
- package/dist/rendering/outline/SceneWrapper.js +522 -0
- package/dist/rendering/outline/SceneWrapper.js.map +1 -0
- package/dist/rendering/outline/ShaderPass.d.ts +12 -0
- package/dist/rendering/outline/ShaderPass.d.ts.map +1 -0
- package/dist/rendering/outline/ShaderPass.js +43 -0
- package/dist/rendering/outline/ShaderPass.js.map +1 -0
- package/dist/rendering/outline/index.d.ts +8 -0
- package/dist/rendering/outline/index.d.ts.map +1 -0
- package/dist/rendering/outline/index.js +8 -0
- package/dist/rendering/outline/index.js.map +1 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.d.ts +20 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.js +131 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.js.map +1 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.d.ts +24 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.js +95 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.js.map +1 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.d.ts +32 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.js +208 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.js.map +1 -0
- package/dist/rendering/outline/shaders.d.ts +20 -0
- package/dist/rendering/outline/shaders.d.ts.map +1 -0
- package/dist/rendering/outline/shaders.js +103 -0
- package/dist/rendering/outline/shaders.js.map +1 -0
- package/dist/rendering/outline/types.d.ts +14 -0
- package/dist/rendering/outline/types.d.ts.map +1 -0
- package/dist/rendering/outline/types.js +16 -0
- package/dist/rendering/outline/types.js.map +1 -0
- package/dist/utilities/Annotations.d.ts +60 -0
- package/dist/utilities/Annotations.d.ts.map +1 -0
- package/dist/utilities/Annotations.js +171 -0
- package/dist/utilities/Annotations.js.map +1 -0
- package/dist/utilities/BaseTable.d.ts +8 -0
- package/dist/utilities/BaseTable.d.ts.map +1 -0
- package/dist/utilities/BaseTable.js +35 -0
- package/dist/utilities/BaseTable.js.map +1 -0
- package/dist/utilities/BboxUtils.d.ts +3 -0
- package/dist/utilities/BboxUtils.d.ts.map +1 -0
- package/dist/utilities/BboxUtils.js +19 -0
- package/dist/utilities/BboxUtils.js.map +1 -0
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts +140 -0
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/CanvasOperations.js +403 -0
- package/dist/utilities/CanvasStack/CanvasOperations.js.map +1 -0
- package/dist/utilities/CanvasStack/CanvasStack.d.ts +42 -0
- package/dist/utilities/CanvasStack/CanvasStack.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/CanvasStack.js +128 -0
- package/dist/utilities/CanvasStack/CanvasStack.js.map +1 -0
- package/dist/utilities/CanvasStack/IconCanvas.d.ts +10 -0
- package/dist/utilities/CanvasStack/IconCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/IconCanvas.js +15 -0
- package/dist/utilities/CanvasStack/IconCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/ImageCache.d.ts +8 -0
- package/dist/utilities/CanvasStack/ImageCache.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ImageCache.js +29 -0
- package/dist/utilities/CanvasStack/ImageCache.js.map +1 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.d.ts +2 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.js +31 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.js.map +1 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.d.ts +10 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.js +15 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts +133 -0
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ReactCanvas.js +161 -0
- package/dist/utilities/CanvasStack/ReactCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts +63 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.js +523 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.js.map +1 -0
- package/dist/utilities/CardMesh.d.ts +17 -0
- package/dist/utilities/CardMesh.d.ts.map +1 -0
- package/dist/utilities/CardMesh.js +44 -0
- package/dist/utilities/CardMesh.js.map +1 -0
- package/dist/utilities/Dice.d.ts +24 -0
- package/dist/utilities/Dice.d.ts.map +1 -0
- package/dist/utilities/Dice.js +148 -0
- package/dist/utilities/Dice.js.map +1 -0
- package/dist/utilities/EventChannel.d.ts +13 -0
- package/dist/utilities/EventChannel.d.ts.map +1 -0
- package/dist/utilities/EventChannel.js +47 -0
- package/dist/utilities/EventChannel.js.map +1 -0
- package/dist/utilities/GalleryItemConversion.d.ts +4 -0
- package/dist/utilities/GalleryItemConversion.d.ts.map +1 -0
- package/dist/utilities/GalleryItemConversion.js +28 -0
- package/dist/utilities/GalleryItemConversion.js.map +1 -0
- package/dist/utilities/IUpdatingCanvas.d.ts +19 -0
- package/dist/utilities/IUpdatingCanvas.d.ts.map +1 -0
- package/dist/utilities/IUpdatingCanvas.js +2 -0
- package/dist/utilities/IUpdatingCanvas.js.map +1 -0
- package/dist/utilities/LayoutHelper.d.ts +34 -0
- package/dist/utilities/LayoutHelper.d.ts.map +1 -0
- package/dist/utilities/LayoutHelper.js +451 -0
- package/dist/utilities/LayoutHelper.js.map +1 -0
- package/dist/utilities/ObjectWithProps.d.ts +5 -0
- package/dist/utilities/ObjectWithProps.d.ts.map +1 -0
- package/dist/utilities/ObjectWithProps.js +65 -0
- package/dist/utilities/ObjectWithProps.js.map +1 -0
- package/dist/utilities/OutlineCanvas.d.ts +12 -0
- package/dist/utilities/OutlineCanvas.d.ts.map +1 -0
- package/dist/utilities/OutlineCanvas.js +31 -0
- package/dist/utilities/OutlineCanvas.js.map +1 -0
- package/dist/utilities/OutlineGeometry.d.ts +3 -0
- package/dist/utilities/OutlineGeometry.d.ts.map +1 -0
- package/dist/utilities/OutlineGeometry.js +57 -0
- package/dist/utilities/OutlineGeometry.js.map +1 -0
- package/dist/utilities/ParameterizedCanvas.d.ts +13 -0
- package/dist/utilities/ParameterizedCanvas.d.ts.map +1 -0
- package/dist/utilities/ParameterizedCanvas.js +85 -0
- package/dist/utilities/ParameterizedCanvas.js.map +1 -0
- package/dist/utilities/RequestSharedAnimationFrame.d.ts +2 -0
- package/dist/utilities/RequestSharedAnimationFrame.d.ts.map +1 -0
- package/dist/utilities/RequestSharedAnimationFrame.js +16 -0
- package/dist/utilities/RequestSharedAnimationFrame.js.map +1 -0
- package/dist/utilities/StaticImage.d.ts +19 -0
- package/dist/utilities/StaticImage.d.ts.map +1 -0
- package/dist/utilities/StaticImage.js +38 -0
- package/dist/utilities/StaticImage.js.map +1 -0
- package/dist/utilities/SvgExtruder.d.ts +20 -0
- package/dist/utilities/SvgExtruder.d.ts.map +1 -0
- package/dist/utilities/SvgExtruder.js +238 -0
- package/dist/utilities/SvgExtruder.js.map +1 -0
- package/dist/utilities/ThreeDisposer.d.ts +11 -0
- package/dist/utilities/ThreeDisposer.d.ts.map +1 -0
- package/dist/utilities/ThreeDisposer.js +53 -0
- package/dist/utilities/ThreeDisposer.js.map +1 -0
- package/dist/utilities/zIndex.d.ts +14 -0
- package/dist/utilities/zIndex.d.ts.map +1 -0
- package/dist/utilities/zIndex.js +14 -0
- package/dist/utilities/zIndex.js.map +1 -0
- package/package.json +138 -0
- package/src/library/assets/checker.svg +4 -0
- package/src/library/assets/cutout.svg +22 -0
- package/src/library/components/ActionLogDisplay.tsx +183 -0
- package/src/library/components/ActionLogHistory.tsx +127 -0
- package/src/library/components/ActionLogHistoryDisplay.tsx +21 -0
- package/src/library/components/ActionLogSidebar.tsx +17 -0
- package/src/library/components/BottomBar.tsx +78 -0
- package/src/library/components/BottomBarBreak.tsx +12 -0
- package/src/library/components/BottomBarButton.tsx +181 -0
- package/src/library/components/CanvasLibraryViewer.tsx +86 -0
- package/src/library/components/ChitLibraryViewer.tsx +168 -0
- package/src/library/components/ClientTrustMatchViewer.tsx +83 -0
- package/src/library/components/ContextGalleryDisplay.tsx +72 -0
- package/src/library/components/GalleryDisplay.tsx +57 -0
- package/src/library/components/GalleryPlayground.tsx +50 -0
- package/src/library/components/GalleryViewer.tsx +773 -0
- package/src/library/components/GameDesigner.tsx +39 -0
- package/src/library/components/GameDialog.tsx +43 -0
- package/src/library/components/GameModalBackdrop.tsx +47 -0
- package/src/library/components/GameModalDialog.tsx +77 -0
- package/src/library/components/LiveButton.tsx +26 -0
- package/src/library/components/MatchEndDisplay.tsx +120 -0
- package/src/library/components/MatchViewer.tsx +111 -0
- package/src/library/components/ObjectWithPropsEditor.tsx +169 -0
- package/src/library/components/Panel/MultiPanel.tsx +276 -0
- package/src/library/components/Panel/PanelContents.tsx +359 -0
- package/src/library/components/Panel/PanelTabStack.tsx +103 -0
- package/src/library/components/Panel/SinglePanel.tsx +75 -0
- package/src/library/components/Panel/ViewerWrapper.tsx +131 -0
- package/src/library/components/Panel/ViewerZoomControls.tsx +216 -0
- package/src/library/components/Panel/util.ts +7 -0
- package/src/library/components/PanelSpark.tsx +112 -0
- package/src/library/components/PersistentCanvas.tsx +81 -0
- package/src/library/components/PlayerImage.tsx +40 -0
- package/src/library/components/Playground.tsx +285 -0
- package/src/library/components/PromptControls.tsx +132 -0
- package/src/library/components/SelectableItemAndStage.tsx +49 -0
- package/src/library/components/SettingsDisplay.tsx +142 -0
- package/src/library/components/SparkLineChart.tsx +307 -0
- package/src/library/components/StageAndEditor.tsx +28 -0
- package/src/library/components/TimeControlBar.tsx +71 -0
- package/src/library/components/TokenizedMessage.tsx +206 -0
- package/src/library/components/TopBar.tsx +90 -0
- package/src/library/components/TopBarDropdown.tsx +94 -0
- package/src/library/components/TopBarPlayers.tsx +163 -0
- package/src/library/components/UpdatingCanvasImage.tsx +25 -0
- package/src/library/components/UpdatingCanvasViewer.tsx +62 -0
- package/src/library/components/Viewer.tsx +360 -0
- package/src/library/components/index.ts +0 -0
- package/src/library/game/Chit.test.ts +66 -0
- package/src/library/game/Chit.ts +575 -0
- package/src/library/game/ClientTimeState.ts +42 -0
- package/src/library/game/ClockDetails.ts +24 -0
- package/src/library/game/Connection.test.ts +50 -0
- package/src/library/game/Connection.ts +122 -0
- package/src/library/game/ConnectionObject.ts +13 -0
- package/src/library/game/ConnectionTransport.ts +52 -0
- package/src/library/game/DropdownChit.tsx +17 -0
- package/src/library/game/GalleryItemChitChildrenSource.ts +31 -0
- package/src/library/game/GalleryItemRawSource.ts +15 -0
- package/src/library/game/Game.ts +55 -0
- package/src/library/game/GameBagChit.ts +42 -0
- package/src/library/game/GameButton.ts +127 -0
- package/src/library/game/GameDeckChit.ts +77 -0
- package/src/library/game/GameTheme.ts +122 -0
- package/src/library/game/Match.ts +187 -0
- package/src/library/game/MatchConnection.ts +5 -0
- package/src/library/game/MatchStorage.ts +51 -0
- package/src/library/game/ModalState.ts +29 -0
- package/src/library/game/OrderedOutlet.ts +198 -0
- package/src/library/game/Pick.ts +314 -0
- package/src/library/game/PlayerChit.ts +43 -0
- package/src/library/game/PlayerInfo.ts +30 -0
- package/src/library/game/PlayerPromptStatusChit.ts +20 -0
- package/src/library/game/Prompt.ts +292 -0
- package/src/library/game/RootChit.ts +54 -0
- package/src/library/game/SparkChit.ts +97 -0
- package/src/library/game/StaticChitTypeRegistry.ts +3 -0
- package/src/library/game/Turn.test.ts +611 -0
- package/src/library/game/Turn.ts +1249 -0
- package/src/library/game/TurnState.ts +187 -0
- package/src/library/game/clientTransport/ClientPrompts.ts +102 -0
- package/src/library/game/clientTransport/ClientStatus.ts +36 -0
- package/src/library/game/clientTransport/ClientTime.ts +256 -0
- package/src/library/game/index.ts +0 -0
- package/src/library/game/serverTransport/ServerPrompts.ts +76 -0
- package/src/library/game/serverTransport/ServerStatus.ts +31 -0
- package/src/library/game/serverTransport/ServerTime.ts +74 -0
- package/src/library/hooks/useChits.ts +32 -0
- package/src/library/hooks/useConnection.tsx +16 -0
- package/src/library/hooks/useEventChannelState.ts +33 -0
- package/src/library/hooks/useGame.tsx +16 -0
- package/src/library/hooks/useGameTheme.tsx +12 -0
- package/src/library/hooks/useModalState.tsx +13 -0
- package/src/library/hooks/usePanelPositioning.tsx +31 -0
- package/src/library/hooks/usePanelScale.tsx +23 -0
- package/src/library/hooks/usePanelStates.ts +30 -0
- package/src/library/hooks/usePlayer.tsx +15 -0
- package/src/library/hooks/useSmartDebouncedState.ts +161 -0
- package/src/library/hooks/useTimeController.tsx +108 -0
- package/src/library/hooks/useTokenMap.ts +20 -0
- package/src/library/hooks/useWebGlRenderer.tsx +227 -0
- package/src/library/index.ts +116 -0
- package/src/library/rendering/CameraSpec.ts +25 -0
- package/src/library/rendering/CameraWrapperPerspective.ts +612 -0
- package/src/library/rendering/ChitGalleryItemInstance.ts +108 -0
- package/src/library/rendering/ChitRenderInstance.ts +1141 -0
- package/src/library/rendering/ChitRenderSpec.ts +213 -0
- package/src/library/rendering/HighlightSpec.ts +5 -0
- package/src/library/rendering/LightSpec.ts +41 -0
- package/src/library/rendering/LightWrapper.ts +152 -0
- package/src/library/rendering/RootChitRenderInstance.ts +460 -0
- package/src/library/rendering/Splay.ts +118 -0
- package/src/library/rendering/SplayCounter.tsx +37 -0
- package/src/library/rendering/TextureReferenceCounter.ts +86 -0
- package/src/library/rendering/index.ts +0 -0
- package/src/library/rendering/outline/DepthVisualizationPass.ts +117 -0
- package/src/library/rendering/outline/EffectComposer.ts +187 -0
- package/src/library/rendering/outline/FullScreenQuad.ts +32 -0
- package/src/library/rendering/outline/IDBasedOutlinePass.ts +741 -0
- package/src/library/rendering/outline/OutputPass.ts +88 -0
- package/src/library/rendering/outline/RenderPass.ts +72 -0
- package/src/library/rendering/outline/SceneWrapper.ts +617 -0
- package/src/library/rendering/outline/ShaderPass.ts +50 -0
- package/src/library/rendering/outline/index.ts +8 -0
- package/src/library/rendering/outline/passes/DebugIDMappingPass.ts +154 -0
- package/src/library/rendering/outline/passes/DepthOcclusionPass.ts +106 -0
- package/src/library/rendering/outline/passes/InterMeshEdgeDetectionPass.ts +244 -0
- package/src/library/rendering/outline/shaders.ts +110 -0
- package/src/library/rendering/outline/types.ts +25 -0
- package/src/library/utilities/Annotations.ts +188 -0
- package/src/library/utilities/BaseTable.tsx +58 -0
- package/src/library/utilities/BboxUtils.ts +23 -0
- package/src/library/utilities/CanvasStack/CanvasOperations.tsx +630 -0
- package/src/library/utilities/CanvasStack/CanvasStack.ts +191 -0
- package/src/library/utilities/CanvasStack/IconCanvas.tsx +17 -0
- package/src/library/utilities/CanvasStack/ImageCache.ts +38 -0
- package/src/library/utilities/CanvasStack/ImageColorOverlayer.ts +36 -0
- package/src/library/utilities/CanvasStack/PlayerCanvas.tsx +17 -0
- package/src/library/utilities/CanvasStack/ReactCanvas.tsx +293 -0
- package/src/library/utilities/CanvasStack/RichTextRenderer.ts +719 -0
- package/src/library/utilities/CardMesh.ts +55 -0
- package/src/library/utilities/Dice.tsx +183 -0
- package/src/library/utilities/EventChannel.ts +52 -0
- package/src/library/utilities/GalleryItemConversion.ts +30 -0
- package/src/library/utilities/IUpdatingCanvas.ts +14 -0
- package/src/library/utilities/LayoutHelper.ts +586 -0
- package/src/library/utilities/ObjectWithProps.ts +52 -0
- package/src/library/utilities/OutlineCanvas.tsx +45 -0
- package/src/library/utilities/OutlineGeometry.ts +69 -0
- package/src/library/utilities/ParameterizedCanvas.ts +78 -0
- package/src/library/utilities/RequestSharedAnimationFrame.ts +16 -0
- package/src/library/utilities/StaticImage.tsx +58 -0
- package/src/library/utilities/SvgExtruder.ts +330 -0
- package/src/library/utilities/ThreeDisposer.ts +66 -0
- package/src/library/utilities/zIndex.ts +15 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import { Box3, PerspectiveCamera, Vector3 } from "three";
|
|
2
|
+
import { RootChitRenderInstance } from "./RootChitRenderInstance";
|
|
3
|
+
import { Easing, Tween } from "@tweenjs/tween.js";
|
|
4
|
+
import { CameraSpec } from "./CameraSpec";
|
|
5
|
+
|
|
6
|
+
interface Point3d {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class CameraWrapperPerspective {
|
|
13
|
+
public cameraSpec = new CameraSpec();
|
|
14
|
+
public camera = new PerspectiveCamera(this.cameraSpec.targetFov, window.innerWidth / window.innerHeight, 0.1, 1000);
|
|
15
|
+
|
|
16
|
+
private firstPositionedCamera?: number;
|
|
17
|
+
private current = { x: 0, y: 0, z: 1 };
|
|
18
|
+
private last = { x: 0, y: 0, z: 1 };
|
|
19
|
+
private width: number = 1;
|
|
20
|
+
private height: number = 1;
|
|
21
|
+
private wiggleRoomX: number = 0;
|
|
22
|
+
private wiggleRoomY: number = 0;
|
|
23
|
+
public visibleGameWidth: number = 0;
|
|
24
|
+
public visibleGameHeight: number = 0;
|
|
25
|
+
|
|
26
|
+
protected offsetTween = new Tween<Point3d>({ x: 0, y: 0, z: 0 });
|
|
27
|
+
protected rotationTween = new Tween<Point3d>({ x: 0, y: 0, z: 0 });
|
|
28
|
+
protected nearFarTween = new Tween<{ near: number; far: number }>({ near: 0.1, far: 1000 });
|
|
29
|
+
|
|
30
|
+
private bbox = new Box3();
|
|
31
|
+
|
|
32
|
+
constructor(private chit: RootChitRenderInstance) {
|
|
33
|
+
this.camera.position.z = 20;
|
|
34
|
+
this.camera.position.y = 0;
|
|
35
|
+
this.camera.position.x = 0;
|
|
36
|
+
this.camera.lookAt(0, 0, 0);
|
|
37
|
+
this.camera.updateProjectionMatrix();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
zeroTween() {
|
|
41
|
+
this.offsetTween.duration(0);
|
|
42
|
+
this.rotationTween.duration(0);
|
|
43
|
+
this.nearFarTween.duration(0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
destroy() {}
|
|
47
|
+
|
|
48
|
+
private getBboxCorners(bbox: Box3): Vector3[] {
|
|
49
|
+
// Return all 8 corners of the bounding box
|
|
50
|
+
return [
|
|
51
|
+
new Vector3(bbox.min.x, bbox.min.y, bbox.min.z), // 0: min-min-min
|
|
52
|
+
new Vector3(bbox.min.x, bbox.min.y, bbox.max.z), // 1: min-min-max
|
|
53
|
+
new Vector3(bbox.min.x, bbox.max.y, bbox.min.z), // 2: min-max-min
|
|
54
|
+
new Vector3(bbox.min.x, bbox.max.y, bbox.max.z), // 3: min-max-max
|
|
55
|
+
new Vector3(bbox.max.x, bbox.min.y, bbox.min.z), // 4: max-min-min
|
|
56
|
+
new Vector3(bbox.max.x, bbox.min.y, bbox.max.z), // 5: max-min-max
|
|
57
|
+
new Vector3(bbox.max.x, bbox.max.y, bbox.min.z), // 6: max-max-min
|
|
58
|
+
new Vector3(bbox.max.x, bbox.max.y, bbox.max.z), // 7: max-max-max
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private calculateOptimalNearFar(bbox: Box3, cameraPosition: Vector3): { near: number; far: number } {
|
|
63
|
+
// Transform bbox to camera space and find analytical closest/farthest distances
|
|
64
|
+
const corners = this.getBboxCorners(bbox);
|
|
65
|
+
|
|
66
|
+
// Find the closest point on the bbox to the camera (analytical approach)
|
|
67
|
+
let closestDistanceSquared = Infinity;
|
|
68
|
+
let farthestDistanceSquared = 0;
|
|
69
|
+
|
|
70
|
+
// For analytical closest point calculation
|
|
71
|
+
const clampToRange = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));
|
|
72
|
+
|
|
73
|
+
// Find closest point on bbox to camera position
|
|
74
|
+
const closestPoint = new Vector3(
|
|
75
|
+
clampToRange(cameraPosition.x, bbox.min.x, bbox.max.x),
|
|
76
|
+
clampToRange(cameraPosition.y, bbox.min.y, bbox.max.y),
|
|
77
|
+
clampToRange(cameraPosition.z, bbox.min.z, bbox.max.z),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
closestDistanceSquared = cameraPosition.distanceToSquared(closestPoint);
|
|
81
|
+
|
|
82
|
+
// Find farthest distance by checking all corners
|
|
83
|
+
for (const corner of corners) {
|
|
84
|
+
const distanceSquared = cameraPosition.distanceToSquared(corner);
|
|
85
|
+
farthestDistanceSquared = Math.max(farthestDistanceSquared, distanceSquared);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const closestDistance = Math.sqrt(closestDistanceSquared);
|
|
89
|
+
const farthestDistance = Math.sqrt(farthestDistanceSquared);
|
|
90
|
+
|
|
91
|
+
// Apply padding - more aggressive for near plane to avoid clipping
|
|
92
|
+
// Use a larger multiplier for far plane with tall objects
|
|
93
|
+
const near = Math.max(0.001, closestDistance * 0.5);
|
|
94
|
+
const far = farthestDistance * 1.5;
|
|
95
|
+
|
|
96
|
+
// Ensure meaningful separation between near and far
|
|
97
|
+
const finalFar = Math.max(far, near + 0.1);
|
|
98
|
+
|
|
99
|
+
return { near, far: finalFar };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public setCameraSpec(cameraSpec?: CameraSpec): void {
|
|
103
|
+
this.cameraSpec = cameraSpec ?? new CameraSpec();
|
|
104
|
+
this.adjust(this.bbox);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public setSize(width: number, height: number): void {
|
|
108
|
+
this.width = width;
|
|
109
|
+
this.height = height;
|
|
110
|
+
this.camera.aspect = width / height;
|
|
111
|
+
|
|
112
|
+
if (this.camera.aspect > 1) {
|
|
113
|
+
this.camera.fov = this.cameraSpec.targetFov / this.camera.aspect;
|
|
114
|
+
} else {
|
|
115
|
+
this.camera.fov = this.cameraSpec.targetFov;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.offsetTween.stop();
|
|
119
|
+
this.rotationTween.stop();
|
|
120
|
+
this.nearFarTween.stop();
|
|
121
|
+
this.camera.updateProjectionMatrix();
|
|
122
|
+
this.adjust(this.bbox);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public get zoom() {
|
|
126
|
+
return this.current.z;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public handlePan(dx: number, dy: number): void {
|
|
130
|
+
this.current.x += dx;
|
|
131
|
+
this.current.y += dy;
|
|
132
|
+
this.lockZoom();
|
|
133
|
+
this.adjust(this.bbox, true);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public handleZoom(x: number, y: number, dz: number, animate: boolean): void {
|
|
137
|
+
const zoom = Math.max(1, Math.min(this.current.z + dz, this.cameraSpec.maxZoom));
|
|
138
|
+
|
|
139
|
+
const halfWidth = this.width / 2;
|
|
140
|
+
const halfHeight = this.height / 2;
|
|
141
|
+
x -= halfWidth;
|
|
142
|
+
y -= halfHeight;
|
|
143
|
+
|
|
144
|
+
const targetX = (this.current.x - x) * (zoom / this.current.z) + x;
|
|
145
|
+
const targetY = (this.current.y - y) * (zoom / this.current.z) + y;
|
|
146
|
+
|
|
147
|
+
this.current.x = targetX;
|
|
148
|
+
this.current.y = targetY;
|
|
149
|
+
this.current.z = zoom;
|
|
150
|
+
this.lockZoom();
|
|
151
|
+
this.adjust(this.bbox, !animate);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private lockZoom() {
|
|
155
|
+
const maxZoom = this.cameraSpec.maxZoom;
|
|
156
|
+
if (this.current.z <= 1) {
|
|
157
|
+
this.current.z = 1;
|
|
158
|
+
this.current.x = 0;
|
|
159
|
+
this.current.y = 0;
|
|
160
|
+
} else {
|
|
161
|
+
if (this.current.z > maxZoom) {
|
|
162
|
+
this.current.z = maxZoom;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const halfWidth = this.width / 2;
|
|
166
|
+
const halfHeight = this.height / 2;
|
|
167
|
+
|
|
168
|
+
// Use a more generous constraint that allows proper panning when zoomed
|
|
169
|
+
// The original formula was: (halfWidth - this.wiggleRoomX / 2) * this.current.z
|
|
170
|
+
// This was too restrictive, so we reduce the wiggleRoom impact
|
|
171
|
+
const maxX = (halfWidth - this.wiggleRoomX / 4) * this.current.z;
|
|
172
|
+
const maxY = (halfHeight - this.wiggleRoomY / 4) * this.current.z;
|
|
173
|
+
|
|
174
|
+
if (this.current.x + halfWidth > maxX) this.current.x = maxX - halfWidth;
|
|
175
|
+
if (this.current.x - halfWidth < -maxX) this.current.x = -maxX + halfWidth;
|
|
176
|
+
if (this.current.y + halfHeight > maxY) this.current.y = maxY - halfHeight;
|
|
177
|
+
if (this.current.y - halfHeight < -maxY) this.current.y = -maxY + halfHeight;
|
|
178
|
+
|
|
179
|
+
const visibleHeight = (this.height - this.wiggleRoomY) * this.current.z;
|
|
180
|
+
const visibleWidth = (this.width - this.wiggleRoomX) * this.current.z;
|
|
181
|
+
if (visibleHeight < this.height) {
|
|
182
|
+
this.current.y = 0;
|
|
183
|
+
}
|
|
184
|
+
if (visibleWidth < this.width) {
|
|
185
|
+
this.current.x = 0;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
public adjust(bbox: Box3, immediate = false) {
|
|
191
|
+
if (!Number.isFinite(bbox.max.x)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Prevent bbox z-height from decreasing too quickly (causes jarring camera adjustments)
|
|
196
|
+
// Only allow z-height to decrease if it drops by more than 25% (i.e., less than 75% of previous)
|
|
197
|
+
const previousZHeight = this.bbox.max.z - this.bbox.min.z;
|
|
198
|
+
const newZHeight = bbox.max.z - bbox.min.z;
|
|
199
|
+
|
|
200
|
+
if (previousZHeight > 0 && newZHeight < previousZHeight) {
|
|
201
|
+
const zHeightRatio = newZHeight / previousZHeight;
|
|
202
|
+
if (zHeightRatio > 0.25) {
|
|
203
|
+
bbox = bbox.clone();
|
|
204
|
+
bbox.max.z = bbox.min.z + previousZHeight;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.bbox = bbox;
|
|
209
|
+
this.offsetTween.stop();
|
|
210
|
+
this.rotationTween.stop();
|
|
211
|
+
this.nearFarTween.stop();
|
|
212
|
+
|
|
213
|
+
const fovRadsY = (this.camera.fov * Math.PI) / 180;
|
|
214
|
+
const fovRadsX = fovRadsY * this.camera.aspect;
|
|
215
|
+
|
|
216
|
+
const xTan = Math.tan(fovRadsX / 2);
|
|
217
|
+
const yTan = Math.tan(fovRadsY / 2);
|
|
218
|
+
|
|
219
|
+
// content sizes (world units)
|
|
220
|
+
const contentWidth = this.bbox.max.x - this.bbox.min.x;
|
|
221
|
+
const contentHeight = this.bbox.max.y - this.bbox.min.y;
|
|
222
|
+
const contentDepth = this.bbox.max.z - this.bbox.min.z;
|
|
223
|
+
const gameHalfWidth = contentWidth / 2;
|
|
224
|
+
const gameHalfHeight = contentHeight / 2;
|
|
225
|
+
const gameAreaX = this.bbox.min.x + gameHalfWidth;
|
|
226
|
+
const gameAreaY = this.bbox.min.y + gameHalfHeight;
|
|
227
|
+
|
|
228
|
+
// We only support per-side pixel paddings now.
|
|
229
|
+
const padLeftPx = this.cameraSpec.paddingLeft;
|
|
230
|
+
const padRightPx = this.cameraSpec.paddingRight;
|
|
231
|
+
const padTopPx = this.cameraSpec.paddingTop + this.cameraSpec.extraPaddingTop;
|
|
232
|
+
const padBottomPx = this.cameraSpec.paddingBottom;
|
|
233
|
+
|
|
234
|
+
const useHorizontalPx = padLeftPx > 0 || padRightPx > 0;
|
|
235
|
+
const useVerticalPx = padTopPx > 0 || padBottomPx > 0;
|
|
236
|
+
|
|
237
|
+
// Compute required distances by projecting bbox corners into screen pixels and iterating
|
|
238
|
+
// until the per-side pixel paddings are satisfied. This directly ensures "N px from the
|
|
239
|
+
// closest point" behavior regardless of camera tilt.
|
|
240
|
+
let centerShiftX = 0;
|
|
241
|
+
let centerShiftY = 0;
|
|
242
|
+
let distance: number;
|
|
243
|
+
|
|
244
|
+
// initial, conservative estimates (no angle) as a starting point for the solver
|
|
245
|
+
{
|
|
246
|
+
let distanceX: number;
|
|
247
|
+
if (useHorizontalPx && this.width > 0) {
|
|
248
|
+
const padPxTotal = Math.max(0, padLeftPx + padRightPx);
|
|
249
|
+
const fractionPx = Math.min(0.999, padPxTotal / this.width); // clamp
|
|
250
|
+
distanceX = gameHalfWidth / xTan / (1 - fractionPx);
|
|
251
|
+
} else {
|
|
252
|
+
distanceX = gameHalfWidth / xTan;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
let distanceY: number;
|
|
256
|
+
if (useVerticalPx && this.height > 0) {
|
|
257
|
+
const padPxTotal = Math.max(0, padTopPx + padBottomPx);
|
|
258
|
+
const fractionPx = Math.min(0.999, padPxTotal / this.height);
|
|
259
|
+
distanceY = gameHalfHeight / yTan / (1 - fractionPx);
|
|
260
|
+
} else {
|
|
261
|
+
distanceY = gameHalfHeight / yTan;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Add extra distance to account for Z-depth of the bbox
|
|
265
|
+
// This ensures the camera is far enough back to see tall objects
|
|
266
|
+
const depthAdjustment = contentDepth * 0.5;
|
|
267
|
+
distance = Math.max(this.cameraSpec.minCameraDistance, Math.max(distanceX, distanceY) + depthAdjustment);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// If padding occupies an excessive fraction of the viewport, fall back to ignoring per-side padding.
|
|
271
|
+
const padHorizontalFraction = this.width > 0 ? Math.max(0, padLeftPx + padRightPx) / this.width : 0;
|
|
272
|
+
const padVerticalFraction = this.height > 0 ? Math.max(0, padTopPx + padBottomPx) / this.height : 0;
|
|
273
|
+
const ignorePaddingBecauseTooLarge = padHorizontalFraction > 0.8 || padVerticalFraction > 0.8;
|
|
274
|
+
|
|
275
|
+
if (ignorePaddingBecauseTooLarge) {
|
|
276
|
+
// Fallback: ignore per-side pixel padding entirely and compute distance from content size only.
|
|
277
|
+
centerShiftX = 0;
|
|
278
|
+
centerShiftY = 0;
|
|
279
|
+
const depthAdjustment = contentDepth * 0.5;
|
|
280
|
+
distance =
|
|
281
|
+
Math.max(this.cameraSpec.minCameraDistance, gameHalfWidth / xTan, gameHalfHeight / yTan) + depthAdjustment;
|
|
282
|
+
|
|
283
|
+
const fallbackPaddedHalfWidth = gameHalfWidth;
|
|
284
|
+
const fallbackPaddedHalfHeight = gameHalfHeight;
|
|
285
|
+
|
|
286
|
+
// wiggleRoom should consider padded sizes (fallback)
|
|
287
|
+
this.wiggleRoomX = (1 - (Math.atan(fallbackPaddedHalfWidth / distance) * 2) / fovRadsX) * this.width;
|
|
288
|
+
this.wiggleRoomY = (1 - (Math.atan(fallbackPaddedHalfHeight / distance) * 2) / fovRadsY) * this.height;
|
|
289
|
+
|
|
290
|
+
// visible sizes in world units (fallback)
|
|
291
|
+
this.visibleGameWidth = xTan * distance * 2;
|
|
292
|
+
this.visibleGameHeight = yTan * distance * 2;
|
|
293
|
+
} else {
|
|
294
|
+
// helper: project a world point into pixel coords for a camera defined by (adjustedCenter, distance)
|
|
295
|
+
const projectPointToPixels = (
|
|
296
|
+
p: Vector3,
|
|
297
|
+
adjustedCenterX: number,
|
|
298
|
+
adjustedCenterY: number,
|
|
299
|
+
distanceVal: number,
|
|
300
|
+
) => {
|
|
301
|
+
const sinH = Math.sin(this.cameraSpec.horizontalRadiansRotation);
|
|
302
|
+
const sinV = Math.sin(this.cameraSpec.verticalRadiansRotation);
|
|
303
|
+
const cosH = Math.cos(this.cameraSpec.horizontalRadiansRotation);
|
|
304
|
+
const cosV = Math.cos(this.cameraSpec.verticalRadiansRotation);
|
|
305
|
+
|
|
306
|
+
const camX = adjustedCenterX + distanceVal * sinH;
|
|
307
|
+
const camY = adjustedCenterY + distanceVal * sinV;
|
|
308
|
+
const camZ = distanceVal * cosH * cosV;
|
|
309
|
+
const camPos = new Vector3(camX, camY, camZ);
|
|
310
|
+
|
|
311
|
+
const lookAt = new Vector3(adjustedCenterX, adjustedCenterY, 0);
|
|
312
|
+
const forward = new Vector3().subVectors(lookAt, camPos).normalize();
|
|
313
|
+
|
|
314
|
+
// world up is +Z (scene plane is at z=0)
|
|
315
|
+
const worldUp = new Vector3(0, 0, 1);
|
|
316
|
+
const right = new Vector3().crossVectors(forward, worldUp).normalize();
|
|
317
|
+
const up = new Vector3().crossVectors(right, forward).normalize();
|
|
318
|
+
|
|
319
|
+
const v = new Vector3().subVectors(p, camPos);
|
|
320
|
+
const x_cam = v.dot(right);
|
|
321
|
+
const y_cam = v.dot(up);
|
|
322
|
+
const z_cam = Math.max(0.0001, v.dot(forward));
|
|
323
|
+
|
|
324
|
+
// NDC coords
|
|
325
|
+
const ndcX = x_cam / (z_cam * xTan);
|
|
326
|
+
const ndcY = y_cam / (z_cam * yTan);
|
|
327
|
+
|
|
328
|
+
const px = (ndcX + 1) * 0.5 * this.width;
|
|
329
|
+
const py = (1 - ndcY) * 0.5 * this.height; // y screen: 0 top
|
|
330
|
+
|
|
331
|
+
return { px, py, z_cam, camPos, forward };
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
// iterative solver: adjust distance and centerShift until projected bbox fits inside padded viewport
|
|
335
|
+
for (let iter = 0; iter < 10; iter++) {
|
|
336
|
+
const adjustedCenterX = gameAreaX + centerShiftX;
|
|
337
|
+
const adjustedCenterY = gameAreaY + centerShiftY;
|
|
338
|
+
|
|
339
|
+
// project all 8 corners of the bbox
|
|
340
|
+
const corners = this.getBboxCorners(this.bbox);
|
|
341
|
+
const projectedCorners = corners.map((corner) =>
|
|
342
|
+
projectPointToPixels(corner, adjustedCenterX, adjustedCenterY, distance),
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
const leftPx = Math.min(...projectedCorners.map((p) => p.px));
|
|
346
|
+
const rightPx = Math.max(...projectedCorners.map((p) => p.px));
|
|
347
|
+
const topPx = Math.min(...projectedCorners.map((p) => p.py));
|
|
348
|
+
const bottomPx = Math.max(...projectedCorners.map((p) => p.py));
|
|
349
|
+
|
|
350
|
+
const contentPxWidth = Math.max(1, rightPx - leftPx);
|
|
351
|
+
const contentPxHeight = Math.max(1, bottomPx - topPx);
|
|
352
|
+
|
|
353
|
+
const allowedPxWidth = Math.max(1, this.width - Math.max(0, padLeftPx + padRightPx));
|
|
354
|
+
const allowedPxHeight = Math.max(1, this.height - Math.max(0, padTopPx + padBottomPx));
|
|
355
|
+
|
|
356
|
+
// scale factor required to fit content into allowed pixel area
|
|
357
|
+
const factorX = allowedPxWidth / contentPxWidth;
|
|
358
|
+
const factorY = allowedPxHeight / contentPxHeight;
|
|
359
|
+
const scale = Math.min(factorX, factorY, 1);
|
|
360
|
+
|
|
361
|
+
// pixel center shift to bring content into the padded center region
|
|
362
|
+
const desiredCenterPxX = Math.max(0, padLeftPx) + allowedPxWidth / 2;
|
|
363
|
+
const desiredCenterPxY = Math.max(0, padTopPx) + allowedPxHeight / 2;
|
|
364
|
+
const currentCenterPxX = (leftPx + rightPx) / 2;
|
|
365
|
+
const currentCenterPxY = (topPx + bottomPx) / 2;
|
|
366
|
+
const pixelShiftX = desiredCenterPxX - currentCenterPxX;
|
|
367
|
+
const pixelShiftY = desiredCenterPxY - currentCenterPxY;
|
|
368
|
+
|
|
369
|
+
// // Debug: per-iteration projected corner pixels and padding/fit diagnostics (safe: vars defined above)
|
|
370
|
+
// try {
|
|
371
|
+
// // eslint-disable-next-line no-console
|
|
372
|
+
// console.debug("[CameraDebug] iter", iter, {
|
|
373
|
+
// corners: {
|
|
374
|
+
// A: { px: pA.px, py: pA.py, z: pA.z_cam },
|
|
375
|
+
// B: { px: pB.px, py: pB.py, z: pB.z_cam },
|
|
376
|
+
// C: { px: pC.px, py: pC.py, z: pC.z_cam },
|
|
377
|
+
// D: { px: pD.px, py: pD.py, z: pD.z_cam },
|
|
378
|
+
// },
|
|
379
|
+
// bounds: { leftPx, rightPx, topPx, bottomPx },
|
|
380
|
+
// contentPx: { width: contentPxWidth, height: contentPxHeight },
|
|
381
|
+
// allowedPx: { width: allowedPxWidth, height: allowedPxHeight, padLeftPx, padRightPx, padTopPx, padBottomPx },
|
|
382
|
+
// scale,
|
|
383
|
+
// pixelShift: { x: pixelShiftX, y: pixelShiftY },
|
|
384
|
+
// centerPx: { currentCenterPxX, currentCenterPxY, desiredCenterPxX, desiredCenterPxY },
|
|
385
|
+
// });
|
|
386
|
+
// } catch (e) {
|
|
387
|
+
// /* swallow debug errors */
|
|
388
|
+
// }
|
|
389
|
+
|
|
390
|
+
// convert pixel shifts to world units using depth at the center (approx)
|
|
391
|
+
const centerProj = projectPointToPixels(
|
|
392
|
+
new Vector3(gameAreaX + centerShiftX, gameAreaY + centerShiftY, 0),
|
|
393
|
+
adjustedCenterX,
|
|
394
|
+
adjustedCenterY,
|
|
395
|
+
distance,
|
|
396
|
+
);
|
|
397
|
+
const depthCenter = Math.max(0.0001, centerProj.z_cam);
|
|
398
|
+
const worldPerPixelCenterX = (2 * xTan * depthCenter) / this.width;
|
|
399
|
+
const worldPerPixelCenterY = (2 * yTan * depthCenter) / this.height;
|
|
400
|
+
|
|
401
|
+
// update center shifts (move content in world units according to pixelShift)
|
|
402
|
+
centerShiftX += pixelShiftX * worldPerPixelCenterX;
|
|
403
|
+
// pixel Y increases downwards; positive pixelShiftY means move content down => increase centerShiftY
|
|
404
|
+
centerShiftY += pixelShiftY * worldPerPixelCenterY;
|
|
405
|
+
|
|
406
|
+
// update distance based on scale (projection scales roughly proportional to 1/distance)
|
|
407
|
+
const newDistance = Math.max(this.cameraSpec.minCameraDistance, distance / Math.max(1e-6, scale));
|
|
408
|
+
|
|
409
|
+
const centerDelta = Math.abs(pixelShiftX) + Math.abs(pixelShiftY);
|
|
410
|
+
|
|
411
|
+
distance = newDistance;
|
|
412
|
+
|
|
413
|
+
// convergence heuristics
|
|
414
|
+
if (scale >= 1 - 1e-3 && centerDelta < 0.5) {
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// After convergence compute final padded half-sizes (approx using center depth)
|
|
420
|
+
// Debug: report final solver state
|
|
421
|
+
// try {
|
|
422
|
+
// // eslint-disable-next-line no-console
|
|
423
|
+
// console.debug("[CameraDebug] final", {
|
|
424
|
+
// distance,
|
|
425
|
+
// centerShift: { x: centerShiftX, y: centerShiftY },
|
|
426
|
+
// viewport: { width: this.width, height: this.height },
|
|
427
|
+
// paddingPx: { left: padLeftPx, right: padRightPx, top: padTopPx, bottom: padBottomPx },
|
|
428
|
+
// });
|
|
429
|
+
// } catch (e) {
|
|
430
|
+
// /* swallow debug errors */
|
|
431
|
+
// }
|
|
432
|
+
|
|
433
|
+
// Use the center of the bbox in Z for depth calculations
|
|
434
|
+
// This prevents issues when bbox has large Z extent
|
|
435
|
+
const bboxCenterZ = (this.bbox.min.z + this.bbox.max.z) / 2;
|
|
436
|
+
const fixedD = Math.max(0.1, distance - bboxCenterZ);
|
|
437
|
+
const visibleWorldPerPixelX = (2 * xTan * fixedD) / this.width;
|
|
438
|
+
const visibleWorldPerPixelY = (2 * yTan * fixedD) / this.height;
|
|
439
|
+
|
|
440
|
+
const paddedHalfWidthUsed = gameHalfWidth + (Math.max(0, padLeftPx + padRightPx) * visibleWorldPerPixelX) / 2;
|
|
441
|
+
const paddedHalfHeightUsed = gameHalfHeight + (Math.max(0, padTopPx + padBottomPx) * visibleWorldPerPixelY) / 2;
|
|
442
|
+
|
|
443
|
+
// wiggleRoom should consider padded sizes
|
|
444
|
+
this.wiggleRoomX = (1 - (Math.atan(paddedHalfWidthUsed / fixedD) * 2) / fovRadsX) * this.width;
|
|
445
|
+
this.wiggleRoomY = (1 - (Math.atan(paddedHalfHeightUsed / fixedD) * 2) / fovRadsY) * this.height;
|
|
446
|
+
|
|
447
|
+
// visible sizes in world units
|
|
448
|
+
this.visibleGameWidth = xTan * fixedD * 2;
|
|
449
|
+
this.visibleGameHeight = yTan * fixedD * 2;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const currentPosition = this.camera.position.clone(),
|
|
453
|
+
currentRotation = this.camera.rotation.clone();
|
|
454
|
+
|
|
455
|
+
if (this.current.z) {
|
|
456
|
+
distance /= this.current.z;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (!distance || !Number.isFinite(distance)) {
|
|
460
|
+
distance = 500;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// centerShiftX/centerShiftY are computed by the angle-aware solver above.
|
|
464
|
+
// If padding is not used they will be zero; no further adjustment needed here.
|
|
465
|
+
|
|
466
|
+
const adjustedCenterX = gameAreaX + centerShiftX;
|
|
467
|
+
const adjustedCenterY = gameAreaY + centerShiftY;
|
|
468
|
+
|
|
469
|
+
// Calculate optimal near/far planes based on actual bbox dimensions and final camera position
|
|
470
|
+
const finalCameraPosition = new Vector3(
|
|
471
|
+
adjustedCenterX + distance * Math.sin(this.cameraSpec.horizontalRadiansRotation),
|
|
472
|
+
adjustedCenterY + distance * Math.sin(this.cameraSpec.verticalRadiansRotation),
|
|
473
|
+
distance *
|
|
474
|
+
Math.cos(this.cameraSpec.horizontalRadiansRotation) *
|
|
475
|
+
Math.cos(this.cameraSpec.verticalRadiansRotation),
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
const optimalPlanes = this.calculateOptimalNearFar(this.bbox, finalCameraPosition);
|
|
479
|
+
|
|
480
|
+
// Safety guard: ensure camera's Z (depth) is positive so camera looks toward scene plane.
|
|
481
|
+
// If rotation causes camZ <= 0 (camera pointing below horizon / behind plane) increase distance slightly until valid.
|
|
482
|
+
{
|
|
483
|
+
const sinH = Math.sin(this.cameraSpec.horizontalRadiansRotation);
|
|
484
|
+
const sinV = Math.sin(this.cameraSpec.verticalRadiansRotation);
|
|
485
|
+
const cosH = Math.cos(this.cameraSpec.horizontalRadiansRotation);
|
|
486
|
+
const cosV = Math.cos(this.cameraSpec.verticalRadiansRotation);
|
|
487
|
+
|
|
488
|
+
// iterative bump to ensure camZ > 0 (prevent black/empty renders)
|
|
489
|
+
let camZ = distance * cosH * cosV;
|
|
490
|
+
if (camZ <= 0) {
|
|
491
|
+
let attempts = 0;
|
|
492
|
+
while (camZ <= 0 && attempts < 20) {
|
|
493
|
+
distance = Math.max(this.cameraSpec.minCameraDistance, distance * 1.15);
|
|
494
|
+
camZ = distance * cosH * cosV;
|
|
495
|
+
attempts++;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// position camera and look at adjusted center
|
|
500
|
+
this.camera.position.x = adjustedCenterX + distance * sinH;
|
|
501
|
+
this.camera.position.y = adjustedCenterY + distance * sinV;
|
|
502
|
+
this.camera.position.z = distance * cosH * cosV;
|
|
503
|
+
this.camera.lookAt(adjustedCenterX, adjustedCenterY, 0);
|
|
504
|
+
|
|
505
|
+
// // Debug: camera state to help diagnose black frames / clipping
|
|
506
|
+
// try {
|
|
507
|
+
// // eslint-disable-next-line no-console
|
|
508
|
+
// console.debug("[CameraDebug] cameraState", {
|
|
509
|
+
// pos: this.camera.position.toArray(),
|
|
510
|
+
// lookAt: [adjustedCenterX, adjustedCenterY, 0],
|
|
511
|
+
// near: this.camera.near,
|
|
512
|
+
// far: this.camera.far,
|
|
513
|
+
// distance,
|
|
514
|
+
// camZ,
|
|
515
|
+
// rotation: {
|
|
516
|
+
// horizontalRadians: this.cameraSpec.horizontalRadiansRotation,
|
|
517
|
+
// verticalRadians: this.cameraSpec.verticalRadiansRotation,
|
|
518
|
+
// },
|
|
519
|
+
// });
|
|
520
|
+
// } catch (e) {
|
|
521
|
+
// /* swallow debug errors */
|
|
522
|
+
// }
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (this.current.z) {
|
|
526
|
+
this.camera.position.x -= (this.current.x / this.current.z / this.width) * this.visibleGameWidth;
|
|
527
|
+
this.camera.position.y += (this.current.y / this.current.z / this.height) * this.visibleGameHeight;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (!this.firstPositionedCamera || Math.abs(Date.now() - this.firstPositionedCamera) < 100) {
|
|
531
|
+
this.firstPositionedCamera ??= Date.now();
|
|
532
|
+
// On first positioning, set near/far immediately
|
|
533
|
+
this.camera.near = optimalPlanes.near;
|
|
534
|
+
this.camera.far = optimalPlanes.far;
|
|
535
|
+
this.camera.updateProjectionMatrix();
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const newPosition = this.camera.position.clone(),
|
|
540
|
+
newRotation = this.camera.rotation.clone();
|
|
541
|
+
|
|
542
|
+
const positionDistance = currentPosition.distanceTo(newPosition),
|
|
543
|
+
rotationDistance = new Vector3()
|
|
544
|
+
.setFromEuler(currentRotation)
|
|
545
|
+
.distanceTo(new Vector3().setFromEuler(newRotation));
|
|
546
|
+
|
|
547
|
+
// Store current near/far values
|
|
548
|
+
const currentNear = this.camera.near;
|
|
549
|
+
const currentFar = this.camera.far;
|
|
550
|
+
const nearFarDistance = Math.abs(optimalPlanes.near - currentNear) + Math.abs(optimalPlanes.far - currentFar);
|
|
551
|
+
|
|
552
|
+
// restore previous camera position/rotation now that we've computed new ones; we'll tween from current -> new
|
|
553
|
+
this.camera.position.set(currentPosition.x, currentPosition.y, currentPosition.z);
|
|
554
|
+
this.camera.rotation.set(currentRotation.x, currentRotation.y, currentRotation.z);
|
|
555
|
+
|
|
556
|
+
const duration = Math.min(
|
|
557
|
+
Math.sqrt(Math.max(positionDistance, rotationDistance)) * this.cameraSpec.offsetSpeed,
|
|
558
|
+
this.cameraSpec.maximumCameraAnimationDuration,
|
|
559
|
+
);
|
|
560
|
+
|
|
561
|
+
if (!immediate) {
|
|
562
|
+
if (positionDistance > 0) {
|
|
563
|
+
this.offsetTween = this.chit.createTween(
|
|
564
|
+
{ x: currentPosition.x, y: currentPosition.y, z: currentPosition.z },
|
|
565
|
+
(tween) =>
|
|
566
|
+
tween
|
|
567
|
+
.to(newPosition, duration)
|
|
568
|
+
.easing(Easing.Quadratic.InOut)
|
|
569
|
+
.onUpdate((obj) => this.camera.position.set(obj.x, obj.y, obj.z)),
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (rotationDistance > 0) {
|
|
574
|
+
this.rotationTween = this.chit.createTween(
|
|
575
|
+
{ x: currentRotation.x, y: currentRotation.y, z: currentRotation.z },
|
|
576
|
+
(tween) =>
|
|
577
|
+
tween
|
|
578
|
+
.to({ x: newRotation.x, y: newRotation.y, z: newRotation.z }, duration)
|
|
579
|
+
.easing(Easing.Quadratic.InOut)
|
|
580
|
+
.onUpdate((obj) => this.camera.rotation.set(obj.x, obj.y, obj.z)),
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Always tween near/far if they differ, even slightly
|
|
585
|
+
if (nearFarDistance > 0.001) {
|
|
586
|
+
this.nearFarTween = this.chit.createTween(
|
|
587
|
+
{ near: currentNear, far: currentFar },
|
|
588
|
+
(tween) =>
|
|
589
|
+
tween
|
|
590
|
+
.to({ near: optimalPlanes.near, far: optimalPlanes.far }, duration)
|
|
591
|
+
.easing(Easing.Quadratic.InOut)
|
|
592
|
+
.onUpdate((obj) => {
|
|
593
|
+
this.camera.near = obj.near;
|
|
594
|
+
this.camera.far = obj.far;
|
|
595
|
+
this.camera.updateProjectionMatrix();
|
|
596
|
+
}),
|
|
597
|
+
);
|
|
598
|
+
} else if (nearFarDistance > 0) {
|
|
599
|
+
// If difference is tiny, just set immediately
|
|
600
|
+
this.camera.near = optimalPlanes.near;
|
|
601
|
+
this.camera.far = optimalPlanes.far;
|
|
602
|
+
this.camera.updateProjectionMatrix();
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
this.camera.rotation.set(newRotation.x, newRotation.y, newRotation.z);
|
|
606
|
+
this.camera.position.set(newPosition.x, newPosition.y, newPosition.z);
|
|
607
|
+
this.camera.near = optimalPlanes.near;
|
|
608
|
+
this.camera.far = optimalPlanes.far;
|
|
609
|
+
this.camera.updateProjectionMatrix();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|