@guilhermebkel/scenec 0.1.1 → 0.2.0
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/README.md +15 -22
- package/dist/Adapters/FileReaderAdapter.d.ts +4 -0
- package/dist/Adapters/FileReaderAdapter.js +21 -0
- package/dist/Adapters/FontAdapter.d.ts +5 -0
- package/dist/Adapters/FontAdapter.js +9 -0
- package/dist/Adapters/ResvgAdapter.d.ts +11 -0
- package/dist/Adapters/ResvgAdapter.js +18 -0
- package/dist/Commands/BaseCommand.d.ts +11 -0
- package/dist/Commands/BaseCommand.js +13 -0
- package/dist/Commands/CatalogCommand.d.ts +6 -0
- package/dist/Commands/CatalogCommand.js +24 -0
- package/dist/Commands/CheckCommand.d.ts +5 -0
- package/dist/Commands/CheckCommand.js +8 -0
- package/dist/Commands/RenderCommand.d.ts +5 -0
- package/dist/Commands/RenderCommand.js +8 -0
- package/dist/Commands/SceneCommand.d.ts +11 -0
- package/dist/Commands/SceneCommand.js +70 -0
- package/dist/Commands/SchemaCommand.d.ts +5 -0
- package/dist/Commands/SchemaCommand.js +12 -0
- package/dist/Data/cities.json +312 -0
- package/dist/Data/europe.json +1 -0
- package/dist/Errors/SceneError.d.ts +4 -0
- package/dist/Errors/SceneError.js +11 -0
- package/dist/Errors/UnsafeSvgError.d.ts +3 -0
- package/dist/Errors/UnsafeSvgError.js +9 -0
- package/dist/Modules/CheckModule.d.ts +8 -0
- package/dist/Modules/CheckModule.js +16 -0
- package/dist/Modules/CompilationModule.d.ts +18 -0
- package/dist/Modules/CompilationModule.js +137 -0
- package/dist/Modules/CritiqueModule.d.ts +6 -0
- package/dist/Modules/CritiqueModule.js +43 -0
- package/dist/Modules/MapModule.d.ts +24 -0
- package/dist/Modules/MapModule.js +99 -0
- package/dist/Modules/ParsingModule.d.ts +17 -0
- package/dist/Modules/ParsingModule.js +88 -0
- package/dist/Modules/PlaneModule.d.ts +19 -0
- package/dist/Modules/PlaneModule.js +98 -0
- package/dist/Protocols/AssetProtocol.d.ts +62 -0
- package/dist/Protocols/AssetProtocol.js +93 -0
- package/dist/Protocols/CommandProtocol.d.ts +6 -0
- package/dist/Protocols/CommandProtocol.js +0 -0
- package/dist/Protocols/CompilationProtocol.d.ts +110 -0
- package/dist/Protocols/CompilationProtocol.js +0 -0
- package/dist/Protocols/CritiqueProtocol.d.ts +42 -0
- package/dist/Protocols/CritiqueProtocol.js +4 -0
- package/dist/Protocols/CustomAssetProtocol.d.ts +24 -0
- package/dist/Protocols/CustomAssetProtocol.js +0 -0
- package/dist/Protocols/GroupProtocol.d.ts +17 -0
- package/dist/Protocols/GroupProtocol.js +12 -0
- package/dist/Protocols/KitProtocol.d.ts +26 -0
- package/dist/Protocols/KitProtocol.js +17 -0
- package/dist/Protocols/MapProtocol.d.ts +77 -0
- package/dist/Protocols/MapProtocol.js +4 -0
- package/dist/Protocols/OptionsProtocol.js +0 -0
- package/dist/Protocols/PersonProtocol.d.ts +64 -0
- package/dist/Protocols/PersonProtocol.js +40 -0
- package/dist/Protocols/PlaneProtocol.d.ts +140 -0
- package/dist/Protocols/PlaneProtocol.js +4 -0
- package/dist/{pipeline/index.d.ts → Protocols/ResultProtocol.d.ts} +0 -2
- package/dist/Protocols/ResultProtocol.js +0 -0
- package/dist/Protocols/SceneProtocol.d.ts +625 -0
- package/dist/Protocols/SceneProtocol.js +304 -0
- package/dist/{protocols/theme.d.ts → Protocols/ThemeProtocol.d.ts} +4 -0
- package/dist/Protocols/ThemeProtocol.js +28 -0
- package/dist/Resources/Assets/BackpackAsset.d.ts +10 -0
- package/dist/Resources/Assets/BackpackAsset.js +31 -0
- package/dist/Resources/Assets/BallAsset.d.ts +10 -0
- package/dist/Resources/Assets/BallAsset.js +15 -0
- package/dist/Resources/Assets/BalloonsAsset.d.ts +10 -0
- package/dist/Resources/Assets/BalloonsAsset.js +26 -0
- package/dist/Resources/Assets/BaseAsset.d.ts +16 -0
- package/dist/Resources/Assets/BaseAsset.js +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.d.ts +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.js +14 -0
- package/dist/Resources/Assets/BedAsset.d.ts +12 -0
- package/dist/Resources/Assets/BedAsset.js +25 -0
- package/dist/Resources/Assets/BenchAsset.d.ts +11 -0
- package/dist/Resources/Assets/BenchAsset.js +24 -0
- package/dist/Resources/Assets/BicycleAsset.d.ts +10 -0
- package/dist/Resources/Assets/BicycleAsset.js +18 -0
- package/dist/Resources/Assets/BigPlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/BigPlantAsset.js +19 -0
- package/dist/Resources/Assets/BirdAsset.d.ts +10 -0
- package/dist/Resources/Assets/BirdAsset.js +14 -0
- package/dist/Resources/Assets/BoardAsset.d.ts +12 -0
- package/dist/Resources/Assets/BoardAsset.js +44 -0
- package/dist/Resources/Assets/BoatAsset.d.ts +10 -0
- package/dist/Resources/Assets/BoatAsset.js +15 -0
- package/dist/Resources/Assets/BooksAsset.d.ts +10 -0
- package/dist/Resources/Assets/BooksAsset.js +35 -0
- package/dist/Resources/Assets/BookshelfAsset.d.ts +10 -0
- package/dist/Resources/Assets/BookshelfAsset.js +33 -0
- package/dist/Resources/Assets/BuildingAsset.d.ts +14 -0
- package/dist/Resources/Assets/BuildingAsset.js +34 -0
- package/dist/Resources/Assets/BurgerAsset.d.ts +9 -0
- package/dist/Resources/Assets/BurgerAsset.js +23 -0
- package/dist/Resources/Assets/BushAsset.d.ts +10 -0
- package/dist/Resources/Assets/BushAsset.js +17 -0
- package/dist/Resources/Assets/CabinetAsset.d.ts +14 -0
- package/dist/Resources/Assets/CabinetAsset.js +49 -0
- package/dist/Resources/Assets/CablesAsset.d.ts +10 -0
- package/dist/Resources/Assets/CablesAsset.js +16 -0
- package/dist/Resources/Assets/CakeAsset.d.ts +10 -0
- package/dist/Resources/Assets/CakeAsset.js +29 -0
- package/dist/Resources/Assets/CapAsset.d.ts +10 -0
- package/dist/Resources/Assets/CapAsset.js +18 -0
- package/dist/Resources/Assets/CarAsset.d.ts +10 -0
- package/dist/Resources/Assets/CarAsset.js +29 -0
- package/dist/Resources/Assets/CatAsset.d.ts +10 -0
- package/dist/Resources/Assets/CatAsset.js +17 -0
- package/dist/Resources/Assets/ChairAsset.d.ts +11 -0
- package/dist/Resources/Assets/ChairAsset.js +32 -0
- package/dist/Resources/Assets/ClockAsset.d.ts +11 -0
- package/dist/Resources/Assets/ClockAsset.js +22 -0
- package/dist/Resources/Assets/CloudAsset.d.ts +10 -0
- package/dist/Resources/Assets/CloudAsset.js +15 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.d.ts +10 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.js +23 -0
- package/dist/Resources/Assets/CounterAsset.d.ts +11 -0
- package/dist/Resources/Assets/CounterAsset.js +29 -0
- package/dist/Resources/Assets/CupAsset.d.ts +10 -0
- package/dist/Resources/Assets/CupAsset.js +17 -0
- package/dist/Resources/Assets/CustomAsset.d.ts +25 -0
- package/dist/Resources/Assets/CustomAsset.js +58 -0
- package/dist/Resources/Assets/DeskAsset.d.ts +11 -0
- package/dist/Resources/Assets/DeskAsset.js +35 -0
- package/dist/Resources/Assets/DeskSlabAsset.d.ts +18 -0
- package/dist/Resources/Assets/DeskSlabAsset.js +43 -0
- package/dist/Resources/Assets/DiplomaAsset.d.ts +10 -0
- package/dist/Resources/Assets/DiplomaAsset.js +23 -0
- package/dist/Resources/Assets/DogAsset.d.ts +10 -0
- package/dist/Resources/Assets/DogAsset.js +24 -0
- package/dist/Resources/Assets/DrawerUnitAsset.d.ts +14 -0
- package/dist/Resources/Assets/DrawerUnitAsset.js +35 -0
- package/dist/Resources/Assets/FenceAsset.d.ts +10 -0
- package/dist/Resources/Assets/FenceAsset.js +26 -0
- package/dist/Resources/Assets/FigurineAsset.d.ts +10 -0
- package/dist/Resources/Assets/FigurineAsset.js +24 -0
- package/dist/Resources/Assets/FinishFlagAsset.d.ts +10 -0
- package/dist/Resources/Assets/FinishFlagAsset.js +21 -0
- package/dist/Resources/Assets/FloorLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/FloorLampAsset.js +22 -0
- package/dist/Resources/Assets/FlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/FlowersAsset.js +37 -0
- package/dist/Resources/Assets/FrameAsset.d.ts +11 -0
- package/dist/Resources/Assets/FrameAsset.js +24 -0
- package/dist/Resources/Assets/FruitBowlAsset.d.ts +10 -0
- package/dist/Resources/Assets/FruitBowlAsset.js +16 -0
- package/dist/Resources/Assets/GlassShelfAsset.d.ts +17 -0
- package/dist/Resources/Assets/GlassShelfAsset.js +25 -0
- package/dist/Resources/Assets/HeadphonesAsset.d.ts +10 -0
- package/dist/Resources/Assets/HeadphonesAsset.js +23 -0
- package/dist/Resources/Assets/HouseAsset.d.ts +10 -0
- package/dist/Resources/Assets/HouseAsset.js +42 -0
- package/dist/Resources/Assets/LabAsset.d.ts +10 -0
- package/dist/Resources/Assets/LabAsset.js +52 -0
- package/dist/Resources/Assets/LampAsset.d.ts +10 -0
- package/dist/Resources/Assets/LampAsset.js +16 -0
- package/dist/Resources/Assets/LaptopAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopAsset.js +23 -0
- package/dist/Resources/Assets/LaptopOpenAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopOpenAsset.js +29 -0
- package/dist/Resources/Assets/LightSwitchAsset.d.ts +11 -0
- package/dist/Resources/Assets/LightSwitchAsset.js +24 -0
- package/dist/Resources/Assets/MonitorAsset.d.ts +10 -0
- package/dist/Resources/Assets/MonitorAsset.js +40 -0
- package/dist/Resources/Assets/MoonAsset.d.ts +10 -0
- package/dist/Resources/Assets/MoonAsset.js +16 -0
- package/dist/Resources/Assets/MountainAsset.d.ts +10 -0
- package/dist/Resources/Assets/MountainAsset.js +15 -0
- package/dist/Resources/Assets/OfficeChairAsset.d.ts +10 -0
- package/dist/Resources/Assets/OfficeChairAsset.js +45 -0
- package/dist/Resources/Assets/PalmAsset.d.ts +10 -0
- package/dist/Resources/Assets/PalmAsset.js +32 -0
- package/dist/Resources/Assets/PaperCupAsset.d.ts +10 -0
- package/dist/Resources/Assets/PaperCupAsset.js +17 -0
- package/dist/Resources/Assets/PendantLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/PendantLampAsset.js +16 -0
- package/dist/Resources/Assets/PennantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PennantAsset.js +15 -0
- package/dist/Resources/Assets/PersonAsset.d.ts +10 -0
- package/dist/Resources/Assets/PersonAsset.js +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.d.ts +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.js +68 -0
- package/dist/Resources/Assets/PineAsset.d.ts +10 -0
- package/dist/Resources/Assets/PineAsset.js +21 -0
- package/dist/Resources/Assets/PizzaAsset.d.ts +10 -0
- package/dist/Resources/Assets/PizzaAsset.js +17 -0
- package/dist/Resources/Assets/PlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlantAsset.js +17 -0
- package/dist/Resources/Assets/PlasticBagAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlasticBagAsset.js +15 -0
- package/dist/Resources/Assets/PlateAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlateAsset.js +17 -0
- package/dist/Resources/Assets/RollingCartAsset.d.ts +11 -0
- package/dist/Resources/Assets/RollingCartAsset.js +34 -0
- package/dist/Resources/Assets/RugAsset.d.ts +10 -0
- package/dist/Resources/Assets/RugAsset.js +19 -0
- package/dist/Resources/Assets/SandcastleAsset.d.ts +10 -0
- package/dist/Resources/Assets/SandcastleAsset.js +30 -0
- package/dist/Resources/Assets/SchoolAsset.d.ts +10 -0
- package/dist/Resources/Assets/SchoolAsset.js +32 -0
- package/dist/Resources/Assets/ShelfWallAsset.d.ts +11 -0
- package/dist/Resources/Assets/ShelfWallAsset.js +23 -0
- package/dist/Resources/Assets/SofaAsset.d.ts +11 -0
- package/dist/Resources/Assets/SofaAsset.js +38 -0
- package/dist/Resources/Assets/StageAsset.d.ts +10 -0
- package/dist/Resources/Assets/StageAsset.js +44 -0
- package/dist/Resources/Assets/StarAsset.d.ts +10 -0
- package/dist/Resources/Assets/StarAsset.js +14 -0
- package/dist/Resources/Assets/StarsAsset.d.ts +11 -0
- package/dist/Resources/Assets/StarsAsset.js +42 -0
- package/dist/Resources/Assets/StreetlightAsset.d.ts +10 -0
- package/dist/Resources/Assets/StreetlightAsset.js +20 -0
- package/dist/Resources/Assets/SuitcaseAsset.d.ts +10 -0
- package/dist/Resources/Assets/SuitcaseAsset.js +42 -0
- package/dist/Resources/Assets/SunAsset.d.ts +10 -0
- package/dist/Resources/Assets/SunAsset.js +22 -0
- package/dist/Resources/Assets/TableAsset.d.ts +15 -0
- package/dist/Resources/Assets/TableAsset.js +21 -0
- package/dist/Resources/Assets/TrashCanAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrashCanAsset.js +31 -0
- package/dist/Resources/Assets/TreeAsset.d.ts +10 -0
- package/dist/Resources/Assets/TreeAsset.js +23 -0
- package/dist/Resources/Assets/TrophyAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrophyAsset.js +16 -0
- package/dist/Resources/Assets/TumblerAsset.d.ts +10 -0
- package/dist/Resources/Assets/TumblerAsset.js +17 -0
- package/dist/Resources/Assets/TvAsset.d.ts +10 -0
- package/dist/Resources/Assets/TvAsset.js +29 -0
- package/dist/Resources/Assets/TvStandAsset.d.ts +11 -0
- package/dist/Resources/Assets/TvStandAsset.js +34 -0
- package/dist/Resources/Assets/UmbrellaAsset.d.ts +10 -0
- package/dist/Resources/Assets/UmbrellaAsset.js +17 -0
- package/dist/Resources/Assets/UniversityAsset.d.ts +10 -0
- package/dist/Resources/Assets/UniversityAsset.js +22 -0
- package/dist/Resources/Assets/VaseFlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/VaseFlowersAsset.js +16 -0
- package/dist/Resources/Assets/WindowAsset.d.ts +11 -0
- package/dist/Resources/Assets/WindowAsset.js +32 -0
- package/dist/Resources/Groups/BaseGroup.d.ts +7 -0
- package/dist/Resources/Groups/BaseGroup.js +5 -0
- package/dist/Resources/Groups/CelebrationGroup.d.ts +8 -0
- package/dist/Resources/Groups/CelebrationGroup.js +19 -0
- package/dist/Resources/Groups/ConversationGroup.d.ts +9 -0
- package/dist/Resources/Groups/ConversationGroup.js +17 -0
- package/dist/Resources/Groups/DiningGroup.d.ts +8 -0
- package/dist/Resources/Groups/DiningGroup.js +21 -0
- package/dist/Resources/Groups/MeetingGroup.d.ts +8 -0
- package/dist/Resources/Groups/MeetingGroup.js +22 -0
- package/dist/Resources/Groups/ParkBenchGroup.d.ts +8 -0
- package/dist/Resources/Groups/ParkBenchGroup.js +17 -0
- package/dist/Resources/Groups/ReadingCornerGroup.d.ts +8 -0
- package/dist/Resources/Groups/ReadingCornerGroup.js +17 -0
- package/dist/Resources/Groups/WorkspaceGroup.d.ts +10 -0
- package/dist/Resources/Groups/WorkspaceGroup.js +25 -0
- package/dist/Resources/Kits/BaseKit.d.ts +12 -0
- package/dist/Resources/Kits/BaseKit.js +11 -0
- package/dist/Resources/Kits/FlatKit.d.ts +5 -0
- package/dist/Resources/Kits/FlatKit.js +8 -0
- package/dist/Resources/Kits/HatchKit.d.ts +15 -0
- package/dist/Resources/Kits/HatchKit.js +12 -0
- package/dist/Resources/Kits/OutlineKit.d.ts +12 -0
- package/dist/Resources/Kits/OutlineKit.js +10 -0
- package/dist/Resources/Kits/PaperKit.d.ts +11 -0
- package/dist/Resources/Kits/PaperKit.js +11 -0
- package/dist/Resources/Kits/RisoKit.d.ts +16 -0
- package/dist/Resources/Kits/RisoKit.js +11 -0
- package/dist/Resources/Kits/SketchKit.d.ts +9 -0
- package/dist/Resources/Kits/SketchKit.js +11 -0
- package/dist/Resources/Themes/BaseTheme.d.ts +5 -0
- package/dist/Resources/Themes/BaseTheme.js +5 -0
- package/dist/Resources/Themes/BeachTheme.d.ts +6 -0
- package/dist/Resources/Themes/BeachTheme.js +31 -0
- package/dist/Resources/Themes/FlatAutumnTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatAutumnTheme.js +29 -0
- package/dist/Resources/Themes/FlatCoolTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatCoolTheme.js +29 -0
- package/dist/Resources/Themes/NightTheme.d.ts +6 -0
- package/dist/Resources/Themes/NightTheme.js +29 -0
- package/dist/Resources/Themes/WarmCafeTheme.d.ts +6 -0
- package/dist/Resources/Themes/WarmCafeTheme.js +29 -0
- package/dist/Services/AssetService.d.ts +12 -0
- package/dist/Services/AssetService.js +204 -0
- package/dist/Services/BackgroundService.d.ts +33 -0
- package/dist/Services/BackgroundService.js +136 -0
- package/dist/Services/BalanceCritiqueService.d.ts +13 -0
- package/dist/Services/BalanceCritiqueService.js +64 -0
- package/dist/Services/CameraService.d.ts +21 -0
- package/dist/Services/CameraService.js +121 -0
- package/dist/Services/CatalogService.d.ts +29 -0
- package/dist/Services/CatalogService.js +51 -0
- package/dist/Services/ContactCritiqueService.d.ts +19 -0
- package/dist/Services/ContactCritiqueService.js +101 -0
- package/dist/Services/ContextService.d.ts +21 -0
- package/dist/Services/ContextService.js +94 -0
- package/dist/Services/CoverageCritiqueService.d.ts +16 -0
- package/dist/Services/CoverageCritiqueService.js +84 -0
- package/dist/Services/CustomAssetService.d.ts +31 -0
- package/dist/Services/CustomAssetService.js +184 -0
- package/dist/Services/DependencyOrderService.d.ts +12 -0
- package/dist/Services/DependencyOrderService.js +73 -0
- package/dist/Services/DescriptionService.d.ts +9 -0
- package/dist/Services/DescriptionService.js +27 -0
- package/dist/Services/FramingCheckService.d.ts +15 -0
- package/dist/Services/FramingCheckService.js +93 -0
- package/dist/Services/GazeService.d.ts +6 -0
- package/dist/Services/GazeService.js +43 -0
- package/dist/Services/GroupService.d.ts +17 -0
- package/dist/Services/GroupService.js +152 -0
- package/dist/Services/KitService.d.ts +23 -0
- package/dist/Services/KitService.js +96 -0
- package/dist/Services/LightingService.d.ts +24 -0
- package/dist/Services/LightingService.js +119 -0
- package/dist/Services/MapBaseService.d.ts +24 -0
- package/dist/Services/MapBaseService.js +104 -0
- package/dist/Services/MapLabelService.d.ts +26 -0
- package/dist/Services/MapLabelService.js +185 -0
- package/dist/Services/MapLegService.d.ts +23 -0
- package/dist/Services/MapLegService.js +87 -0
- package/dist/Services/MapPanelService.d.ts +16 -0
- package/dist/Services/MapPanelService.js +89 -0
- package/dist/Services/MapPinService.d.ts +11 -0
- package/dist/Services/MapPinService.js +56 -0
- package/dist/Services/MapProjectionService.d.ts +14 -0
- package/dist/Services/MapProjectionService.js +70 -0
- package/dist/Services/MapRouteService.d.ts +17 -0
- package/dist/Services/MapRouteService.js +79 -0
- package/dist/Services/PieceService.d.ts +43 -0
- package/dist/Services/PieceService.js +154 -0
- package/dist/Services/PlacementService.d.ts +60 -0
- package/dist/Services/PlacementService.js +415 -0
- package/dist/Services/PlaneBackgroundService.d.ts +24 -0
- package/dist/Services/PlaneBackgroundService.js +170 -0
- package/dist/Services/PlaneBoxService.d.ts +27 -0
- package/dist/Services/PlaneBoxService.js +209 -0
- package/dist/Services/PlaneDepthService.d.ts +18 -0
- package/dist/Services/PlaneDepthService.js +146 -0
- package/dist/Services/PlaneLabelService.d.ts +13 -0
- package/dist/Services/PlaneLabelService.js +115 -0
- package/dist/Services/PlaneObjectService.d.ts +17 -0
- package/dist/Services/PlaneObjectService.js +147 -0
- package/dist/Services/PlanePathService.d.ts +15 -0
- package/dist/Services/PlanePathService.js +98 -0
- package/dist/Services/PlaneProjectionService.d.ts +16 -0
- package/dist/Services/PlaneProjectionService.js +90 -0
- package/dist/Services/PlaneRoadService.d.ts +13 -0
- package/dist/Services/PlaneRoadService.js +105 -0
- package/dist/Services/PlaneScatterService.d.ts +11 -0
- package/dist/Services/PlaneScatterService.js +48 -0
- package/dist/Services/PlaneSpaceService.d.ts +27 -0
- package/dist/Services/PlaneSpaceService.js +96 -0
- package/dist/Services/PlaneSpriteService.d.ts +29 -0
- package/dist/Services/PlaneSpriteService.js +95 -0
- package/dist/Services/PlaneTitleService.d.ts +17 -0
- package/dist/Services/PlaneTitleService.js +126 -0
- package/dist/Services/PlaneZoneService.d.ts +20 -0
- package/dist/Services/PlaneZoneService.js +121 -0
- package/dist/Services/RasterService.d.ts +10 -0
- package/dist/Services/RasterService.js +68 -0
- package/dist/Services/SchemaService.d.ts +3 -0
- package/dist/Services/SchemaService.js +10 -0
- package/dist/Services/SilhouetteCritiqueService.d.ts +32 -0
- package/dist/Services/SilhouetteCritiqueService.js +155 -0
- package/dist/Services/TextService.d.ts +47 -0
- package/dist/Services/TextService.js +178 -0
- package/dist/Services/ThemeService.d.ts +5 -0
- package/dist/Services/ThemeService.js +18 -0
- package/dist/Utils/BoxUtil.d.ts +4 -0
- package/dist/Utils/BoxUtil.js +8 -0
- package/dist/Utils/ColorUtil.d.ts +20 -0
- package/dist/Utils/ColorUtil.js +51 -0
- package/dist/Utils/CurveUtil.d.ts +6 -0
- package/dist/Utils/CurveUtil.js +35 -0
- package/dist/Utils/FallbackUtil.d.ts +3 -0
- package/dist/Utils/FallbackUtil.js +8 -0
- package/dist/Utils/FormatUtil.d.ts +4 -0
- package/dist/Utils/FormatUtil.js +9 -0
- package/dist/Utils/IdUtil.d.ts +4 -0
- package/dist/Utils/IdUtil.js +11 -0
- package/dist/Utils/NormalizeUtil.d.ts +4 -0
- package/dist/Utils/NormalizeUtil.js +9 -0
- package/dist/Utils/OklabUtil.d.ts +23 -0
- package/dist/Utils/OklabUtil.js +62 -0
- package/dist/Utils/PersonArmUtil.d.ts +19 -0
- package/dist/Utils/PersonArmUtil.js +84 -0
- package/dist/Utils/PersonHeadUtil.d.ts +31 -0
- package/dist/Utils/PersonHeadUtil.js +154 -0
- package/dist/Utils/PersonOutfitUtil.d.ts +48 -0
- package/dist/Utils/PersonOutfitUtil.js +178 -0
- package/dist/Utils/PersonUtil.d.ts +39 -0
- package/dist/Utils/PersonUtil.js +206 -0
- package/dist/Utils/PixelUtil.d.ts +3 -0
- package/dist/Utils/PixelUtil.js +8 -0
- package/dist/Utils/RecolorUtil.d.ts +40 -0
- package/dist/Utils/RecolorUtil.js +155 -0
- package/dist/Utils/RegistryUtil.d.ts +8 -0
- package/dist/Utils/RegistryUtil.js +19 -0
- package/dist/Utils/RequireUtil.d.ts +3 -0
- package/dist/Utils/RequireUtil.js +11 -0
- package/dist/Utils/SanitizeUtil.d.ts +25 -0
- package/dist/Utils/SanitizeUtil.js +210 -0
- package/dist/Utils/SeedUtil.d.ts +6 -0
- package/dist/Utils/SeedUtil.js +15 -0
- package/dist/Utils/ShapeUtil.d.ts +31 -0
- package/dist/Utils/ShapeUtil.js +47 -0
- package/dist/Utils/SuggestUtil.d.ts +7 -0
- package/dist/Utils/SuggestUtil.js +25 -0
- package/dist/Utils/SvgUtil.d.ts +9 -0
- package/dist/Utils/SvgUtil.js +21 -0
- package/dist/Utils/ThemeUtil.d.ts +4 -0
- package/dist/Utils/ThemeUtil.js +13 -0
- package/dist/Utils/TransportUtil.d.ts +24 -0
- package/dist/Utils/TransportUtil.js +108 -0
- package/dist/cli.js +24 -97
- package/dist/index.d.ts +10 -6
- package/dist/index.js +14 -2
- package/dist/render.d.ts +8 -5
- package/dist/render.js +21 -3
- package/dist/schema.d.ts +9 -2
- package/dist/schema.js +29 -5
- package/package.json +3 -2
- package/skills/{scenec → draw-scene}/SKILL.md +15 -19
- package/skills/{scenec → draw-scene}/references/catalog.md +14 -14
- package/skills/{scenec → draw-scene}/references/dsl.md +9 -3
- package/dist/catalog.d.ts +0 -21
- package/dist/catalog.js +0 -35
- package/dist/data/europe.json +0 -1
- package/dist/drawing/assets.d.ts +0 -8
- package/dist/drawing/assets.js +0 -612
- package/dist/drawing/kits.d.ts +0 -7
- package/dist/drawing/kits.js +0 -92
- package/dist/drawing/person.d.ts +0 -18
- package/dist/drawing/person.js +0 -287
- package/dist/drawing/themes.d.ts +0 -4
- package/dist/drawing/themes.js +0 -45
- package/dist/modes/map.d.ts +0 -5
- package/dist/modes/map.js +0 -365
- package/dist/modes/plane.d.ts +0 -5
- package/dist/modes/plane.js +0 -716
- package/dist/pipeline/compile.d.ts +0 -2
- package/dist/pipeline/compile.js +0 -581
- package/dist/pipeline/custom.d.ts +0 -2
- package/dist/pipeline/custom.js +0 -120
- package/dist/pipeline/groups.d.ts +0 -2
- package/dist/pipeline/groups.js +0 -189
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/parse.d.ts +0 -10
- package/dist/pipeline/parse.js +0 -80
- package/dist/protocols/options.js +0 -1
- package/dist/protocols/scene.d.ts +0 -299
- package/dist/protocols/scene.js +0 -118
- package/dist/protocols/theme.js +0 -1
- package/dist/render/check.d.ts +0 -6
- package/dist/render/check.js +0 -10
- package/dist/render/critic.d.ts +0 -1
- package/dist/render/critic.js +0 -235
- package/dist/render/files.d.ts +0 -2
- package/dist/render/files.js +0 -16
- package/dist/render/fonts.d.ts +0 -2
- package/dist/render/fonts.js +0 -4
- package/dist/render/png.d.ts +0 -9
- package/dist/render/png.js +0 -13
- package/dist/utils/color.d.ts +0 -5
- package/dist/utils/color.js +0 -35
- package/dist/utils/recolor.d.ts +0 -1
- package/dist/utils/recolor.js +0 -56
- package/dist/utils/sanitize.d.ts +0 -5
- package/dist/utils/sanitize.js +0 -169
- package/dist/utils/suggest.d.ts +0 -1
- package/dist/utils/suggest.js +0 -22
- package/dist/utils/svg.d.ts +0 -2
- package/dist/utils/svg.js +0 -11
- package/skills/scenec/references/fontes.md +0 -8
- /package/dist/{protocols/options.d.ts → Protocols/OptionsProtocol.d.ts} +0 -0
- /package/skills/{scenec/recipes/anuncios-variacoes.yaml → draw-scene/recipes/ad-variations.yaml} +0 -0
- /package/skills/{scenec/recipes/carrossel.yaml → draw-scene/recipes/carousel.yaml} +0 -0
- /package/skills/{scenec/recipes/elearning.yaml → draw-scene/recipes/e-learning.yaml} +0 -0
- /package/skills/{scenec/recipes/reels-explicativo.yaml → draw-scene/recipes/explainer-reel.yaml} +0 -0
- /package/skills/{scenec/recipes/historia-ilustrada.yaml → draw-scene/recipes/illustrated-story.yaml} +0 -0
- /package/skills/{scenec/recipes/mapas-jornadas.yaml → draw-scene/recipes/journey-map.yaml} +0 -0
- /package/skills/{scenec/recipes/wrapped-personalizado.yaml → draw-scene/recipes/personalized-wrapped.yaml} +0 -0
- /package/skills/{scenec/recipes/ilustracoes-produto.yaml → draw-scene/recipes/product-illustration.yaml} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { RegistryUtil } from "../Utils/RegistryUtil.js";
|
|
2
|
+
import { SuggestUtil } from "../Utils/SuggestUtil.js";
|
|
3
|
+
import { PersonAsset } from "../Resources/Assets/PersonAsset.js";
|
|
4
|
+
import { HouseAsset } from "../Resources/Assets/HouseAsset.js";
|
|
5
|
+
import { TreeAsset } from "../Resources/Assets/TreeAsset.js";
|
|
6
|
+
import { PineAsset } from "../Resources/Assets/PineAsset.js";
|
|
7
|
+
import { PalmAsset } from "../Resources/Assets/PalmAsset.js";
|
|
8
|
+
import { BushAsset } from "../Resources/Assets/BushAsset.js";
|
|
9
|
+
import { FlowersAsset } from "../Resources/Assets/FlowersAsset.js";
|
|
10
|
+
import { FenceAsset } from "../Resources/Assets/FenceAsset.js";
|
|
11
|
+
import { BuildingAsset } from "../Resources/Assets/BuildingAsset.js";
|
|
12
|
+
import { MountainAsset } from "../Resources/Assets/MountainAsset.js";
|
|
13
|
+
import { SunAsset } from "../Resources/Assets/SunAsset.js";
|
|
14
|
+
import { MoonAsset } from "../Resources/Assets/MoonAsset.js";
|
|
15
|
+
import { CloudAsset } from "../Resources/Assets/CloudAsset.js";
|
|
16
|
+
import { BirdAsset } from "../Resources/Assets/BirdAsset.js";
|
|
17
|
+
import { StarAsset } from "../Resources/Assets/StarAsset.js";
|
|
18
|
+
import { StarsAsset } from "../Resources/Assets/StarsAsset.js";
|
|
19
|
+
import { CarAsset } from "../Resources/Assets/CarAsset.js";
|
|
20
|
+
import { BicycleAsset } from "../Resources/Assets/BicycleAsset.js";
|
|
21
|
+
import { DogAsset } from "../Resources/Assets/DogAsset.js";
|
|
22
|
+
import { CatAsset } from "../Resources/Assets/CatAsset.js";
|
|
23
|
+
import { StreetlightAsset } from "../Resources/Assets/StreetlightAsset.js";
|
|
24
|
+
import { BenchAsset } from "../Resources/Assets/BenchAsset.js";
|
|
25
|
+
import { WindowAsset } from "../Resources/Assets/WindowAsset.js";
|
|
26
|
+
import { FrameAsset } from "../Resources/Assets/FrameAsset.js";
|
|
27
|
+
import { ClockAsset } from "../Resources/Assets/ClockAsset.js";
|
|
28
|
+
import { BoardAsset } from "../Resources/Assets/BoardAsset.js";
|
|
29
|
+
import { ShelfWallAsset } from "../Resources/Assets/ShelfWallAsset.js";
|
|
30
|
+
import { BookshelfAsset } from "../Resources/Assets/BookshelfAsset.js";
|
|
31
|
+
import { DeskAsset } from "../Resources/Assets/DeskAsset.js";
|
|
32
|
+
import { TableAsset } from "../Resources/Assets/TableAsset.js";
|
|
33
|
+
import { CounterAsset } from "../Resources/Assets/CounterAsset.js";
|
|
34
|
+
import { ChairAsset } from "../Resources/Assets/ChairAsset.js";
|
|
35
|
+
import { SofaAsset } from "../Resources/Assets/SofaAsset.js";
|
|
36
|
+
import { BedAsset } from "../Resources/Assets/BedAsset.js";
|
|
37
|
+
import { TvAsset } from "../Resources/Assets/TvAsset.js";
|
|
38
|
+
import { TvStandAsset } from "../Resources/Assets/TvStandAsset.js";
|
|
39
|
+
import { FloorLampAsset } from "../Resources/Assets/FloorLampAsset.js";
|
|
40
|
+
import { RugAsset } from "../Resources/Assets/RugAsset.js";
|
|
41
|
+
import { PendantLampAsset } from "../Resources/Assets/PendantLampAsset.js";
|
|
42
|
+
import { LaptopAsset } from "../Resources/Assets/LaptopAsset.js";
|
|
43
|
+
import { MonitorAsset } from "../Resources/Assets/MonitorAsset.js";
|
|
44
|
+
import { LampAsset } from "../Resources/Assets/LampAsset.js";
|
|
45
|
+
import { PlantAsset } from "../Resources/Assets/PlantAsset.js";
|
|
46
|
+
import { BigPlantAsset } from "../Resources/Assets/BigPlantAsset.js";
|
|
47
|
+
import { CupAsset } from "../Resources/Assets/CupAsset.js";
|
|
48
|
+
import { CakeAsset } from "../Resources/Assets/CakeAsset.js";
|
|
49
|
+
import { PizzaAsset } from "../Resources/Assets/PizzaAsset.js";
|
|
50
|
+
import { FruitBowlAsset } from "../Resources/Assets/FruitBowlAsset.js";
|
|
51
|
+
import { BurgerAsset } from "../Resources/Assets/BurgerAsset.js";
|
|
52
|
+
import { PlateAsset } from "../Resources/Assets/PlateAsset.js";
|
|
53
|
+
import { VaseFlowersAsset } from "../Resources/Assets/VaseFlowersAsset.js";
|
|
54
|
+
import { BooksAsset } from "../Resources/Assets/BooksAsset.js";
|
|
55
|
+
import { CoffeeMachineAsset } from "../Resources/Assets/CoffeeMachineAsset.js";
|
|
56
|
+
import { UmbrellaAsset } from "../Resources/Assets/UmbrellaAsset.js";
|
|
57
|
+
import { BoatAsset } from "../Resources/Assets/BoatAsset.js";
|
|
58
|
+
import { SuitcaseAsset } from "../Resources/Assets/SuitcaseAsset.js";
|
|
59
|
+
import { BackpackAsset } from "../Resources/Assets/BackpackAsset.js";
|
|
60
|
+
import { BeachTowelAsset } from "../Resources/Assets/BeachTowelAsset.js";
|
|
61
|
+
import { BallAsset } from "../Resources/Assets/BallAsset.js";
|
|
62
|
+
import { SandcastleAsset } from "../Resources/Assets/SandcastleAsset.js";
|
|
63
|
+
import { SchoolAsset } from "../Resources/Assets/SchoolAsset.js";
|
|
64
|
+
import { UniversityAsset } from "../Resources/Assets/UniversityAsset.js";
|
|
65
|
+
import { LabAsset } from "../Resources/Assets/LabAsset.js";
|
|
66
|
+
import { StageAsset } from "../Resources/Assets/StageAsset.js";
|
|
67
|
+
import { FinishFlagAsset } from "../Resources/Assets/FinishFlagAsset.js";
|
|
68
|
+
import { PennantAsset } from "../Resources/Assets/PennantAsset.js";
|
|
69
|
+
import { BalloonsAsset } from "../Resources/Assets/BalloonsAsset.js";
|
|
70
|
+
import { DiplomaAsset } from "../Resources/Assets/DiplomaAsset.js";
|
|
71
|
+
import { TrophyAsset } from "../Resources/Assets/TrophyAsset.js";
|
|
72
|
+
import { DeskSlabAsset } from "../Resources/Assets/DeskSlabAsset.js";
|
|
73
|
+
import { DrawerUnitAsset } from "../Resources/Assets/DrawerUnitAsset.js";
|
|
74
|
+
import { CabinetAsset } from "../Resources/Assets/CabinetAsset.js";
|
|
75
|
+
import { RollingCartAsset } from "../Resources/Assets/RollingCartAsset.js";
|
|
76
|
+
import { TrashCanAsset } from "../Resources/Assets/TrashCanAsset.js";
|
|
77
|
+
import { OfficeChairAsset } from "../Resources/Assets/OfficeChairAsset.js";
|
|
78
|
+
import { LaptopOpenAsset } from "../Resources/Assets/LaptopOpenAsset.js";
|
|
79
|
+
import { HeadphonesAsset } from "../Resources/Assets/HeadphonesAsset.js";
|
|
80
|
+
import { CapAsset } from "../Resources/Assets/CapAsset.js";
|
|
81
|
+
import { PhotoFrameAsset } from "../Resources/Assets/PhotoFrameAsset.js";
|
|
82
|
+
import { FigurineAsset } from "../Resources/Assets/FigurineAsset.js";
|
|
83
|
+
import { TumblerAsset } from "../Resources/Assets/TumblerAsset.js";
|
|
84
|
+
import { PaperCupAsset } from "../Resources/Assets/PaperCupAsset.js";
|
|
85
|
+
import { PlasticBagAsset } from "../Resources/Assets/PlasticBagAsset.js";
|
|
86
|
+
import { CablesAsset } from "../Resources/Assets/CablesAsset.js";
|
|
87
|
+
import { LightSwitchAsset } from "../Resources/Assets/LightSwitchAsset.js";
|
|
88
|
+
import { GlassShelfAsset } from "../Resources/Assets/GlassShelfAsset.js";
|
|
89
|
+
class AssetService {
|
|
90
|
+
static CANDIDATE_POOL = 6;
|
|
91
|
+
static SUGGESTION_COUNT = 3;
|
|
92
|
+
static ASSET_ID_TO_ASSET = RegistryUtil.indexById(
|
|
93
|
+
[
|
|
94
|
+
new PersonAsset(),
|
|
95
|
+
new HouseAsset(),
|
|
96
|
+
new TreeAsset(),
|
|
97
|
+
new PineAsset(),
|
|
98
|
+
new PalmAsset(),
|
|
99
|
+
new BushAsset(),
|
|
100
|
+
new FlowersAsset(),
|
|
101
|
+
new FenceAsset(),
|
|
102
|
+
new BuildingAsset(),
|
|
103
|
+
new MountainAsset(),
|
|
104
|
+
new SunAsset(),
|
|
105
|
+
new MoonAsset(),
|
|
106
|
+
new CloudAsset(),
|
|
107
|
+
new BirdAsset(),
|
|
108
|
+
new StarAsset(),
|
|
109
|
+
new StarsAsset(),
|
|
110
|
+
new CarAsset(),
|
|
111
|
+
new BicycleAsset(),
|
|
112
|
+
new DogAsset(),
|
|
113
|
+
new CatAsset(),
|
|
114
|
+
new StreetlightAsset(),
|
|
115
|
+
new BenchAsset(),
|
|
116
|
+
new WindowAsset(),
|
|
117
|
+
new FrameAsset(),
|
|
118
|
+
new ClockAsset(),
|
|
119
|
+
new BoardAsset(),
|
|
120
|
+
new ShelfWallAsset(),
|
|
121
|
+
new BookshelfAsset(),
|
|
122
|
+
new DeskAsset(),
|
|
123
|
+
new TableAsset(),
|
|
124
|
+
new CounterAsset(),
|
|
125
|
+
new ChairAsset(),
|
|
126
|
+
new SofaAsset(),
|
|
127
|
+
new BedAsset(),
|
|
128
|
+
new TvAsset(),
|
|
129
|
+
new TvStandAsset(),
|
|
130
|
+
new FloorLampAsset(),
|
|
131
|
+
new RugAsset(),
|
|
132
|
+
new PendantLampAsset(),
|
|
133
|
+
new LaptopAsset(),
|
|
134
|
+
new MonitorAsset(),
|
|
135
|
+
new LampAsset(),
|
|
136
|
+
new PlantAsset(),
|
|
137
|
+
new BigPlantAsset(),
|
|
138
|
+
new CupAsset(),
|
|
139
|
+
new CakeAsset(),
|
|
140
|
+
new PizzaAsset(),
|
|
141
|
+
new FruitBowlAsset(),
|
|
142
|
+
new BurgerAsset(),
|
|
143
|
+
new PlateAsset(),
|
|
144
|
+
new VaseFlowersAsset(),
|
|
145
|
+
new BooksAsset(),
|
|
146
|
+
new CoffeeMachineAsset(),
|
|
147
|
+
new UmbrellaAsset(),
|
|
148
|
+
new BoatAsset(),
|
|
149
|
+
new SuitcaseAsset(),
|
|
150
|
+
new BackpackAsset(),
|
|
151
|
+
new BeachTowelAsset(),
|
|
152
|
+
new BallAsset(),
|
|
153
|
+
new SandcastleAsset(),
|
|
154
|
+
new SchoolAsset(),
|
|
155
|
+
new UniversityAsset(),
|
|
156
|
+
new LabAsset(),
|
|
157
|
+
new StageAsset(),
|
|
158
|
+
new FinishFlagAsset(),
|
|
159
|
+
new PennantAsset(),
|
|
160
|
+
new BalloonsAsset(),
|
|
161
|
+
new DiplomaAsset(),
|
|
162
|
+
new TrophyAsset(),
|
|
163
|
+
new DeskSlabAsset(),
|
|
164
|
+
new DrawerUnitAsset(),
|
|
165
|
+
new CabinetAsset(),
|
|
166
|
+
new RollingCartAsset(),
|
|
167
|
+
new TrashCanAsset(),
|
|
168
|
+
new OfficeChairAsset(),
|
|
169
|
+
new LaptopOpenAsset(),
|
|
170
|
+
new HeadphonesAsset(),
|
|
171
|
+
new CapAsset(),
|
|
172
|
+
new PhotoFrameAsset(),
|
|
173
|
+
new FigurineAsset(),
|
|
174
|
+
new TumblerAsset(),
|
|
175
|
+
new PaperCupAsset(),
|
|
176
|
+
new PlasticBagAsset(),
|
|
177
|
+
new CablesAsset(),
|
|
178
|
+
new LightSwitchAsset(),
|
|
179
|
+
new GlassShelfAsset()
|
|
180
|
+
]
|
|
181
|
+
);
|
|
182
|
+
static resolveAsset(name, library = AssetService.ASSET_ID_TO_ASSET) {
|
|
183
|
+
if (library[name]) {
|
|
184
|
+
return { id: name };
|
|
185
|
+
}
|
|
186
|
+
const lowered = name.toLowerCase();
|
|
187
|
+
const byTag = Object.entries(library).find(([, asset]) => (asset.tags ?? []).includes(lowered));
|
|
188
|
+
if (byTag) {
|
|
189
|
+
return { id: byTag[0] };
|
|
190
|
+
}
|
|
191
|
+
const candidates = [];
|
|
192
|
+
for (const [id, asset] of Object.entries(library)) {
|
|
193
|
+
for (const key of [id, ...asset.tags ?? []]) {
|
|
194
|
+
candidates.push([SuggestUtil.distance(lowered, key), id]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
candidates.sort((first, second) => first[0] - second[0]);
|
|
198
|
+
const nearest = candidates.slice(0, AssetService.CANDIDATE_POOL).map((candidate) => candidate[1]);
|
|
199
|
+
return { id: null, suggest: [...new Set(nearest)].slice(0, AssetService.SUGGESTION_COUNT) };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
AssetService
|
|
204
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Background, CompilationContext } from "../Protocols/CompilationProtocol.js";
|
|
2
|
+
export declare class BackgroundService {
|
|
3
|
+
private static readonly OUTDOOR_HAZE;
|
|
4
|
+
private static readonly INDOOR_HAZE;
|
|
5
|
+
private static readonly DEFAULT_SHADOW_ALPHA;
|
|
6
|
+
private static readonly PLANK_COUNT;
|
|
7
|
+
private static readonly PLANK_MARGIN;
|
|
8
|
+
private static readonly PLANK_SPREAD;
|
|
9
|
+
private static readonly PLANK_VANISH_HEIGHT;
|
|
10
|
+
private static readonly SHADE_CYCLE;
|
|
11
|
+
private static readonly SHADE_STEP;
|
|
12
|
+
private static readonly BOARD_LINES;
|
|
13
|
+
private static readonly CITY_DASHES;
|
|
14
|
+
private static readonly WAVE_COUNT;
|
|
15
|
+
private static readonly SETTING_TO_HAZE;
|
|
16
|
+
private static readonly SETTING_TO_AIR;
|
|
17
|
+
private static readonly SETTING_TO_OUTDOOR_DRAWER;
|
|
18
|
+
private static readonly SETTING_TO_HILLS;
|
|
19
|
+
private static readonly SETTING_TO_FOREGROUND;
|
|
20
|
+
private static readonly FLOOR_TO_DRAWER;
|
|
21
|
+
static build(context: CompilationContext): Background;
|
|
22
|
+
private static hazeLevels;
|
|
23
|
+
private static shadowRgba;
|
|
24
|
+
private static hazeFilter;
|
|
25
|
+
private static defs;
|
|
26
|
+
private static indoor;
|
|
27
|
+
private static planks;
|
|
28
|
+
private static floorLines;
|
|
29
|
+
private static beach;
|
|
30
|
+
private static hills;
|
|
31
|
+
private static open;
|
|
32
|
+
private static street;
|
|
33
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ColorUtil } from "../Utils/ColorUtil.js";
|
|
2
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
3
|
+
class BackgroundService {
|
|
4
|
+
static OUTDOOR_HAZE = { far: 0.32, mid: 0.13 };
|
|
5
|
+
static INDOOR_HAZE = { far: 0.08, mid: 0.04 };
|
|
6
|
+
static DEFAULT_SHADOW_ALPHA = 0.15;
|
|
7
|
+
static PLANK_COUNT = 16;
|
|
8
|
+
static PLANK_MARGIN = 6;
|
|
9
|
+
static PLANK_SPREAD = 1.6;
|
|
10
|
+
static PLANK_VANISH_HEIGHT = 0.9;
|
|
11
|
+
static SHADE_CYCLE = 3;
|
|
12
|
+
static SHADE_STEP = 0.03;
|
|
13
|
+
static BOARD_LINES = 8;
|
|
14
|
+
static CITY_DASHES = 10;
|
|
15
|
+
static WAVE_COUNT = 6;
|
|
16
|
+
static SETTING_TO_HAZE = {
|
|
17
|
+
indoor: BackgroundService.INDOOR_HAZE
|
|
18
|
+
};
|
|
19
|
+
static SETTING_TO_AIR = { indoor: "wall" };
|
|
20
|
+
static SETTING_TO_OUTDOOR_DRAWER = {
|
|
21
|
+
beach: (context) => BackgroundService.beach(context)
|
|
22
|
+
};
|
|
23
|
+
static SETTING_TO_HILLS = {
|
|
24
|
+
outdoor: (context) => BackgroundService.hills(context)
|
|
25
|
+
};
|
|
26
|
+
static SETTING_TO_FOREGROUND = {
|
|
27
|
+
city: (context) => BackgroundService.street(context)
|
|
28
|
+
};
|
|
29
|
+
static FLOOR_TO_DRAWER = {
|
|
30
|
+
planks: (context) => BackgroundService.planks(context)
|
|
31
|
+
};
|
|
32
|
+
static build(context) {
|
|
33
|
+
const { theme, setting } = context;
|
|
34
|
+
const haze = BackgroundService.hazeLevels(context);
|
|
35
|
+
const shadowRgba = BackgroundService.shadowRgba(theme);
|
|
36
|
+
const defs = BackgroundService.defs(context, haze, shadowRgba);
|
|
37
|
+
if (setting === "indoor") {
|
|
38
|
+
return { svg: defs + BackgroundService.indoor(context), haze, shadowRgba, textBackdrop: theme.wall };
|
|
39
|
+
}
|
|
40
|
+
const drawOutdoor = IdUtil.lookup(BackgroundService.SETTING_TO_OUTDOOR_DRAWER, setting);
|
|
41
|
+
const outdoor = drawOutdoor ? drawOutdoor(context) : BackgroundService.open(context);
|
|
42
|
+
return { svg: defs + outdoor, haze, shadowRgba, textBackdrop: theme.skyTop };
|
|
43
|
+
}
|
|
44
|
+
static hazeLevels(context) {
|
|
45
|
+
if (context.canvas.haze === false) {
|
|
46
|
+
return { far: 0, mid: 0 };
|
|
47
|
+
}
|
|
48
|
+
const levels = IdUtil.lookup(BackgroundService.SETTING_TO_HAZE, context.setting);
|
|
49
|
+
return { ...levels ?? BackgroundService.OUTDOOR_HAZE };
|
|
50
|
+
}
|
|
51
|
+
static shadowRgba(theme) {
|
|
52
|
+
const numbers = (theme.shadow.match(/[\d.]+/g) ?? []).map(Number);
|
|
53
|
+
const [red = 0, green = 0, blue = 0, alpha = BackgroundService.DEFAULT_SHADOW_ALPHA] = numbers;
|
|
54
|
+
return [red, green, blue, alpha];
|
|
55
|
+
}
|
|
56
|
+
static hazeFilter(id, strength, air) {
|
|
57
|
+
const [red = 0, green = 0, blue = 0] = [1, 3, 5].map((start) => parseInt(air.slice(start, start + 2), 16) / 255);
|
|
58
|
+
const keep = 1 - strength;
|
|
59
|
+
return `<filter id="${id}" color-interpolation-filters="sRGB"><feColorMatrix type="matrix" values="${keep} 0 0 0 ${(red * strength).toFixed(3)} 0 ${keep} 0 0 ${(green * strength).toFixed(3)} 0 0 ${keep} 0 ${(blue * strength).toFixed(3)} 0 0 0 1 0"/></filter>`;
|
|
60
|
+
}
|
|
61
|
+
static defs(context, haze, shadowRgba) {
|
|
62
|
+
const { theme, setting } = context;
|
|
63
|
+
const airName = IdUtil.lookup(BackgroundService.SETTING_TO_AIR, setting) ?? "skyBottom";
|
|
64
|
+
const air = theme[airName];
|
|
65
|
+
const [red, green, blue, alpha] = shadowRgba;
|
|
66
|
+
const shadowColor = `rgb(${red},${green},${blue})`;
|
|
67
|
+
const hazeFar = BackgroundService.hazeFilter("hazeFar", haze.far, air);
|
|
68
|
+
const hazeMid = BackgroundService.hazeFilter("hazeMid", haze.mid, air);
|
|
69
|
+
return `<defs><linearGradient id="sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${theme.skyTop}"/><stop offset="1" stop-color="${theme.skyBottom}"/></linearGradient><radialGradient id="cshadow"><stop offset="0" stop-color="${shadowColor}" stop-opacity="${alpha * 1.5}"/><stop offset="0.55" stop-color="${shadowColor}" stop-opacity="${alpha * 1.1}"/><stop offset="1" stop-color="${shadowColor}" stop-opacity="0"/></radialGradient>` + hazeFar + hazeMid + "</defs>";
|
|
70
|
+
}
|
|
71
|
+
static indoor(context) {
|
|
72
|
+
const { theme, width, height, lines, canvas } = context;
|
|
73
|
+
const horizonY = height * lines.horizon;
|
|
74
|
+
const base = `<rect width="${width}" height="${horizonY}" fill="${theme.wall}"/><rect y="${horizonY}" width="${width}" height="${height - horizonY}" fill="${theme.floor}"/><rect y="${horizonY - 8}" width="${width}" height="10" fill="${theme.woodDark}" opacity="0.35"/>`;
|
|
75
|
+
const drawFloor = IdUtil.lookup(BackgroundService.FLOOR_TO_DRAWER, canvas.floor);
|
|
76
|
+
return base + (drawFloor ? drawFloor(context) : BackgroundService.floorLines(context));
|
|
77
|
+
}
|
|
78
|
+
static planks(context) {
|
|
79
|
+
const { theme, width, height, lines, canvas } = context;
|
|
80
|
+
const horizonY = height * lines.horizon;
|
|
81
|
+
const vanishX = width * (canvas.vanish ?? 0.5);
|
|
82
|
+
const vanishY = horizonY - height * BackgroundService.PLANK_VANISH_HEIGHT;
|
|
83
|
+
const count = BackgroundService.PLANK_COUNT;
|
|
84
|
+
const spread = BackgroundService.PLANK_SPREAD;
|
|
85
|
+
const atHorizon = (column) => vanishX + (column - vanishX) * (horizonY - vanishY) / (height - vanishY);
|
|
86
|
+
let svg = "";
|
|
87
|
+
for (let index = -BackgroundService.PLANK_MARGIN; index < count + BackgroundService.PLANK_MARGIN; index++) {
|
|
88
|
+
const left = index / count * width * spread - width * ((spread - 1) / 2);
|
|
89
|
+
const right = (index + 1) / count * width * spread - width * ((spread - 1) / 2);
|
|
90
|
+
const shade = index % BackgroundService.SHADE_CYCLE * BackgroundService.SHADE_STEP - BackgroundService.SHADE_STEP;
|
|
91
|
+
svg += `<path d="M${atHorizon(left).toFixed(1)} ${horizonY} L${atHorizon(right).toFixed(1)} ${horizonY} L${right.toFixed(1)} ${height} L${left.toFixed(1)} ${height} Z" fill="${ColorUtil.sh(theme.floor, shade)}"/><path d="M${atHorizon(left).toFixed(1)} ${horizonY} L${left.toFixed(1)} ${height}" stroke="${ColorUtil.sh(theme.floor, -0.3)}" stroke-width="1.2" opacity="0.6"/>`;
|
|
92
|
+
}
|
|
93
|
+
return svg;
|
|
94
|
+
}
|
|
95
|
+
static floorLines(context) {
|
|
96
|
+
const { theme, width, height, lines } = context;
|
|
97
|
+
const horizonY = height * lines.horizon;
|
|
98
|
+
let svg = "";
|
|
99
|
+
for (let index = 1; index < BackgroundService.BOARD_LINES; index++) {
|
|
100
|
+
const lineY = horizonY + (height - horizonY) * (index / BackgroundService.BOARD_LINES) ** 1.4 - 0.75;
|
|
101
|
+
svg += `<rect x="0" y="${lineY.toFixed(1)}" width="${width}" height="1.5" fill="${theme.woodDark}" opacity="0.15"/>`;
|
|
102
|
+
}
|
|
103
|
+
return svg;
|
|
104
|
+
}
|
|
105
|
+
static beach(context) {
|
|
106
|
+
const { theme, width, height, lines } = context;
|
|
107
|
+
const horizonY = height * lines.horizon;
|
|
108
|
+
const seaY = height * (lines.sea ?? lines.horizon);
|
|
109
|
+
let svg = `<rect width="${width}" height="${height}" fill="url(#sky)"/><rect y="${horizonY}" width="${width}" height="${seaY - horizonY}" fill="${theme.sea}"/><path d="M0 ${seaY} Q${width * 0.25} ${seaY - 14} ${width * 0.5} ${seaY} T${width} ${seaY} L${width} ${height} L0 ${height} Z" fill="${theme.ground}"/>`;
|
|
110
|
+
for (let index = 0; index < BackgroundService.WAVE_COUNT; index++) {
|
|
111
|
+
svg += `<path d="M${width * (0.08 + index * 0.17)} ${horizonY + 18 + index % 3 * 22} q14 -6 28 0" stroke="${theme.seaLight}" stroke-width="3" fill="none" stroke-linecap="round"/>`;
|
|
112
|
+
}
|
|
113
|
+
return svg + `<path d="M0 ${seaY - 4} Q${width * 0.25} ${seaY - 18} ${width * 0.5} ${seaY - 4} T${width} ${seaY - 4}" stroke="${theme.paper}" stroke-width="4" fill="none" opacity="0.7"/>`;
|
|
114
|
+
}
|
|
115
|
+
static hills(context) {
|
|
116
|
+
const { theme, width, height, lines } = context;
|
|
117
|
+
const horizonY = height * lines.horizon;
|
|
118
|
+
return `<path d="M0 ${horizonY} Q${width * 0.2} ${horizonY - 50} ${width * 0.45} ${horizonY - 10} T${width} ${horizonY - 30} L${width} ${height} L0 ${height} Z" fill="${theme.groundDark}" opacity="0.55"/>`;
|
|
119
|
+
}
|
|
120
|
+
static open(context) {
|
|
121
|
+
const { theme, width, height, lines, setting } = context;
|
|
122
|
+
const horizonY = height * lines.horizon;
|
|
123
|
+
const drawHills = IdUtil.lookup(BackgroundService.SETTING_TO_HILLS, setting);
|
|
124
|
+
const drawForeground = IdUtil.lookup(BackgroundService.SETTING_TO_FOREGROUND, setting);
|
|
125
|
+
const svg = `<rect width="${width}" height="${height}" fill="url(#sky)"/>` + (drawHills ? drawHills(context) : "") + `<path d="M0 ${horizonY + 12} Q${width * 0.3} ${horizonY - 6} ${width * 0.6} ${horizonY + 10} T${width} ${horizonY + 4} L${width} ${height} L0 ${height} Z" fill="${theme.ground}"/>`;
|
|
126
|
+
return drawForeground ? svg + drawForeground(context) : svg;
|
|
127
|
+
}
|
|
128
|
+
static street(context) {
|
|
129
|
+
const { theme, width, height } = context;
|
|
130
|
+
const dashes = Array.from({ length: BackgroundService.CITY_DASHES }, (_, index) => `<rect x="${index * width / BackgroundService.CITY_DASHES + 20}" y="${height * 0.925}" width="${width / 20}" height="5" fill="${theme.primary}" opacity="0.5"/>`);
|
|
131
|
+
return `<rect y="${height * 0.86}" width="${width}" height="${height * 0.14}" fill="${theme.groundDark}"/>` + dashes.join("");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
BackgroundService
|
|
136
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TextRect } from "../Protocols/CompilationProtocol.js";
|
|
2
|
+
import type { Raster } from "../Protocols/CritiqueProtocol.js";
|
|
3
|
+
export declare class BalanceCritiqueService {
|
|
4
|
+
private static readonly WEIGHT_CAP;
|
|
5
|
+
private static readonly WEIGHT_FLOOR;
|
|
6
|
+
private static readonly MAX_OFF_CENTER;
|
|
7
|
+
private static readonly BOXED_TEXT_WEIGHT;
|
|
8
|
+
private static readonly PLAIN_TEXT_WEIGHT;
|
|
9
|
+
private static readonly LAB_COMPONENTS;
|
|
10
|
+
static critique(raster: Raster, textRects: readonly TextRect[]): string[];
|
|
11
|
+
private static difference;
|
|
12
|
+
private static leaning;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FormatUtil } from "../Utils/FormatUtil.js";
|
|
2
|
+
import { OklabUtil } from "../Utils/OklabUtil.js";
|
|
3
|
+
import { PixelUtil } from "../Utils/PixelUtil.js";
|
|
4
|
+
class BalanceCritiqueService {
|
|
5
|
+
static WEIGHT_CAP = 0.3;
|
|
6
|
+
static WEIGHT_FLOOR = 0.02;
|
|
7
|
+
static MAX_OFF_CENTER = 0.15;
|
|
8
|
+
static BOXED_TEXT_WEIGHT = 0.25;
|
|
9
|
+
static PLAIN_TEXT_WEIGHT = 0.12;
|
|
10
|
+
static LAB_COMPONENTS = 3;
|
|
11
|
+
static critique(raster, textRects) {
|
|
12
|
+
const objectWeights = raster.objects.map(() => 0);
|
|
13
|
+
let totalWeight = 0;
|
|
14
|
+
let weightedColumns = 0;
|
|
15
|
+
for (let index = 0; index < raster.pixelCount; index++) {
|
|
16
|
+
const weight = Math.min(BalanceCritiqueService.WEIGHT_CAP, BalanceCritiqueService.difference(raster, index));
|
|
17
|
+
if (weight < BalanceCritiqueService.WEIGHT_FLOOR) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
totalWeight += weight;
|
|
21
|
+
weightedColumns += weight * (index % raster.width);
|
|
22
|
+
const owner = PixelUtil.read(raster.owner, index);
|
|
23
|
+
if (owner >= 0) {
|
|
24
|
+
objectWeights[owner] = (objectWeights[owner] ?? 0) + weight;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
for (const rect of textRects) {
|
|
28
|
+
const isBoxed = rect.hasBox;
|
|
29
|
+
const kindWeight = isBoxed ? BalanceCritiqueService.BOXED_TEXT_WEIGHT : BalanceCritiqueService.PLAIN_TEXT_WEIGHT;
|
|
30
|
+
const weight = (rect.x1 - rect.x0) * (rect.y1 - rect.y0) * raster.factor * raster.factor * kindWeight;
|
|
31
|
+
totalWeight += weight;
|
|
32
|
+
weightedColumns += weight * ((rect.x0 + rect.x1) / 2) * raster.factor;
|
|
33
|
+
}
|
|
34
|
+
if (totalWeight <= 0) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const center = weightedColumns / totalWeight / raster.width;
|
|
38
|
+
return Math.abs(center - 0.5) > BalanceCritiqueService.MAX_OFF_CENTER ? [BalanceCritiqueService.leaning(raster, objectWeights, center)] : [];
|
|
39
|
+
}
|
|
40
|
+
static difference(raster, index) {
|
|
41
|
+
const offset = index * BalanceCritiqueService.LAB_COMPONENTS;
|
|
42
|
+
const labAt = (lab) => [
|
|
43
|
+
PixelUtil.read(lab, offset),
|
|
44
|
+
PixelUtil.read(lab, offset + 1),
|
|
45
|
+
PixelUtil.read(lab, offset + 2)
|
|
46
|
+
];
|
|
47
|
+
return OklabUtil.distance(labAt(raster.fullLab), labAt(raster.backLab));
|
|
48
|
+
}
|
|
49
|
+
static leaning(raster, objectWeights, center) {
|
|
50
|
+
const isLeft = center < 0.5;
|
|
51
|
+
const middle = raster.width / 2;
|
|
52
|
+
const heaviest = raster.objects.map((object, index) => ({ object, weight: objectWeights[index] ?? 0 })).filter(({ object }) => {
|
|
53
|
+
const objectCenter = (object.box.left + object.box.right) / 2;
|
|
54
|
+
return isLeft ? objectCenter < middle : objectCenter > middle;
|
|
55
|
+
}).sort((first, second) => second.weight - first.weight)[0];
|
|
56
|
+
const side = isLeft ? "left" : "right";
|
|
57
|
+
const opposite = isLeft ? "right" : "left";
|
|
58
|
+
const advice = heaviest ? `move '${heaviest.object.id}' toward the center or ` : "";
|
|
59
|
+
return `visual weight leans ${side} (center of mass at ${FormatUtil.percent(center)} of the width); ${advice}put something on the ${opposite} side`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
BalanceCritiqueService
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Camera, CompilationContext, Placement } from "../Protocols/CompilationProtocol.js";
|
|
2
|
+
export declare class CameraService {
|
|
3
|
+
static readonly NEUTRAL: Camera;
|
|
4
|
+
private static readonly SHOT_TO_CONFIG;
|
|
5
|
+
private static readonly LEFT_THIRD;
|
|
6
|
+
private static readonly RIGHT_THIRD;
|
|
7
|
+
private static readonly FOCUSABLE_KINDS;
|
|
8
|
+
private static readonly FRAME_TO_FRACTION;
|
|
9
|
+
private static readonly MAX_ZOOM;
|
|
10
|
+
private static readonly FOCUS_WIDTH_FRACTION;
|
|
11
|
+
private static readonly PERSON_SIDE_PADDING;
|
|
12
|
+
private static readonly CENTERED_FOCUS_HEIGHT;
|
|
13
|
+
private static readonly OFF_VIEW_MARGIN;
|
|
14
|
+
static frame(idToPlacement: Record<string, Placement>, context: CompilationContext): Camera;
|
|
15
|
+
private static isPerson;
|
|
16
|
+
private static focusIds;
|
|
17
|
+
private static focusedPlacements;
|
|
18
|
+
private static boundsOf;
|
|
19
|
+
private static cameraFor;
|
|
20
|
+
private static transform;
|
|
21
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
2
|
+
class CameraService {
|
|
3
|
+
static NEUTRAL = { zoom: 1, translateX: 0, translateY: 0 };
|
|
4
|
+
static SHOT_TO_CONFIG = {
|
|
5
|
+
full: { fill: 0.55 },
|
|
6
|
+
medium: { show: 0.62, top: 0.12 },
|
|
7
|
+
close: { show: 0.3, top: 0.08 }
|
|
8
|
+
};
|
|
9
|
+
static LEFT_THIRD = 0.3333333333333333;
|
|
10
|
+
static RIGHT_THIRD = 0.6666666666666666;
|
|
11
|
+
static FOCUSABLE_KINDS = ["ground", "any"];
|
|
12
|
+
static FRAME_TO_FRACTION = {
|
|
13
|
+
left: CameraService.LEFT_THIRD,
|
|
14
|
+
center: 0.5,
|
|
15
|
+
right: CameraService.RIGHT_THIRD
|
|
16
|
+
};
|
|
17
|
+
static MAX_ZOOM = 6;
|
|
18
|
+
static FOCUS_WIDTH_FRACTION = 0.8;
|
|
19
|
+
static PERSON_SIDE_PADDING = 0.5;
|
|
20
|
+
static CENTERED_FOCUS_HEIGHT = 0.55;
|
|
21
|
+
static OFF_VIEW_MARGIN = 0.02;
|
|
22
|
+
static frame(idToPlacement, context) {
|
|
23
|
+
const shot = context.canvas.shot ?? "wide";
|
|
24
|
+
if (shot === "wide") {
|
|
25
|
+
return CameraService.NEUTRAL;
|
|
26
|
+
}
|
|
27
|
+
const config = IdUtil.lookup(CameraService.SHOT_TO_CONFIG, shot);
|
|
28
|
+
if (!config) {
|
|
29
|
+
context.warnings.push(`shot '${shot}' is invalid; use wide, full, medium or close`);
|
|
30
|
+
return CameraService.NEUTRAL;
|
|
31
|
+
}
|
|
32
|
+
const focused = CameraService.focusedPlacements(idToPlacement, context, config);
|
|
33
|
+
if (focused.length === 0) {
|
|
34
|
+
return CameraService.NEUTRAL;
|
|
35
|
+
}
|
|
36
|
+
const bounds = CameraService.boundsOf(focused);
|
|
37
|
+
const camera = CameraService.cameraFor(bounds, config, context);
|
|
38
|
+
for (const placement of Object.values(idToPlacement)) {
|
|
39
|
+
CameraService.transform(placement, camera, context);
|
|
40
|
+
}
|
|
41
|
+
for (const placement of focused) {
|
|
42
|
+
placement.isFocus = true;
|
|
43
|
+
}
|
|
44
|
+
return camera;
|
|
45
|
+
}
|
|
46
|
+
static isPerson(placement) {
|
|
47
|
+
return placement.asset === "person";
|
|
48
|
+
}
|
|
49
|
+
static focusIds(idToPlacement, context) {
|
|
50
|
+
const requested = [].concat(context.canvas.focus ?? []);
|
|
51
|
+
const ids = [];
|
|
52
|
+
for (const focus of requested) {
|
|
53
|
+
const matches = idToPlacement[focus] ? [focus] : Object.keys(idToPlacement).filter((key) => key.startsWith(`${focus}_`));
|
|
54
|
+
if (matches.length === 0) {
|
|
55
|
+
context.warnings.push(`focus '${focus}' does not exist in the scene`);
|
|
56
|
+
}
|
|
57
|
+
ids.push(...matches);
|
|
58
|
+
}
|
|
59
|
+
if (ids.length > 0) {
|
|
60
|
+
return ids;
|
|
61
|
+
}
|
|
62
|
+
const all = Object.values(idToPlacement);
|
|
63
|
+
const people = all.filter((placement) => CameraService.isPerson(placement));
|
|
64
|
+
if (people.length > 0) {
|
|
65
|
+
return people.map((placement) => placement.id);
|
|
66
|
+
}
|
|
67
|
+
return all.filter((placement) => IdUtil.isOneOf(CameraService.FOCUSABLE_KINDS, placement.kind)).map((placement) => placement.id);
|
|
68
|
+
}
|
|
69
|
+
static focusedPlacements(idToPlacement, context, config) {
|
|
70
|
+
const focused = CameraService.focusIds(idToPlacement, context).flatMap((id) => idToPlacement[id] ?? []);
|
|
71
|
+
const hasPerson = focused.some((placement) => CameraService.isPerson(placement));
|
|
72
|
+
return config.top != null && hasPerson ? focused.filter((placement) => CameraService.isPerson(placement)) : focused;
|
|
73
|
+
}
|
|
74
|
+
static boundsOf(focused) {
|
|
75
|
+
const padding = (placement) => {
|
|
76
|
+
return CameraService.isPerson(placement) ? placement.width * CameraService.PERSON_SIDE_PADDING : 0;
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
left: Math.min(...focused.map((placement) => placement.boxLeft - padding(placement))),
|
|
80
|
+
right: Math.max(...focused.map((placement) => placement.boxRight + padding(placement))),
|
|
81
|
+
top: Math.min(...focused.map((placement) => placement.boxTop)),
|
|
82
|
+
bottom: Math.max(...focused.map((placement) => placement.boxBottom))
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
static cameraFor(bounds, config, context) {
|
|
86
|
+
const { width, height, canvas } = context;
|
|
87
|
+
const top = canvas.headroom ?? config.top;
|
|
88
|
+
const focusHeight = Math.max(1, bounds.bottom - bounds.top);
|
|
89
|
+
const heightZoom = config.fill ? config.fill * height / focusHeight : (1 - (top ?? 0)) * height / ((config.show ?? 1) * focusHeight);
|
|
90
|
+
const widthZoom = CameraService.FOCUS_WIDTH_FRACTION * width / Math.max(1, bounds.right - bounds.left);
|
|
91
|
+
const limited = Math.min(CameraService.MAX_ZOOM, heightZoom, widthZoom);
|
|
92
|
+
const zoom = Math.max(1, limited);
|
|
93
|
+
const named = IdUtil.lookup(CameraService.FRAME_TO_FRACTION, canvas.frame ?? "center") ?? 0.5;
|
|
94
|
+
const target = typeof canvas.frame === "number" ? canvas.frame : named;
|
|
95
|
+
const translateX = target * width - (bounds.left + bounds.right) / 2 * zoom;
|
|
96
|
+
const translateY = top == null ? CameraService.CENTERED_FOCUS_HEIGHT * height - (bounds.top + bounds.bottom) / 2 * zoom : top * height - bounds.top * zoom;
|
|
97
|
+
return {
|
|
98
|
+
zoom,
|
|
99
|
+
translateX: Math.min(0, Math.max(width - width * zoom, translateX)),
|
|
100
|
+
translateY: Math.min(0, Math.max(height - height * zoom, translateY))
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static transform(placement, camera, context) {
|
|
104
|
+
const { zoom, translateX, translateY } = camera;
|
|
105
|
+
const { width, height } = context;
|
|
106
|
+
placement.x = placement.x * zoom + translateX;
|
|
107
|
+
placement.y = placement.y * zoom + translateY;
|
|
108
|
+
placement.scale *= zoom;
|
|
109
|
+
placement.width *= zoom;
|
|
110
|
+
placement.height *= zoom;
|
|
111
|
+
placement.boxLeft = placement.boxLeft * zoom + translateX;
|
|
112
|
+
placement.boxRight = placement.boxRight * zoom + translateX;
|
|
113
|
+
placement.boxTop = placement.boxTop * zoom + translateY;
|
|
114
|
+
placement.boxBottom = placement.boxBottom * zoom + translateY;
|
|
115
|
+
const margin = CameraService.OFF_VIEW_MARGIN;
|
|
116
|
+
placement.isOffView = placement.boxRight < -margin * width || placement.boxLeft > (1 + margin) * width || placement.boxBottom < -margin * height || placement.boxTop > (1 + margin) * height;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
CameraService
|
|
121
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ThemeId } from "../Protocols/ThemeProtocol.js";
|
|
2
|
+
import type { AssetKind } from "../Protocols/AssetProtocol.js";
|
|
3
|
+
export type CatalogKind = typeof CatalogService.CATALOG_KINDS[number];
|
|
4
|
+
export interface AssetEntry {
|
|
5
|
+
id: string;
|
|
6
|
+
kind: AssetKind;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
synonyms: string[];
|
|
10
|
+
}
|
|
11
|
+
type PartIdToAsset = Record<string, string>;
|
|
12
|
+
export interface GroupEntry {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
parts: PartIdToAsset;
|
|
16
|
+
}
|
|
17
|
+
export declare class CatalogService {
|
|
18
|
+
static readonly CATALOG_KINDS: readonly ["assets", "groups", "kits", "themes", "poses", "layout"];
|
|
19
|
+
static listAssets(): AssetEntry[];
|
|
20
|
+
static listGroups(): GroupEntry[];
|
|
21
|
+
static listKits(): {
|
|
22
|
+
id: string;
|
|
23
|
+
description: string;
|
|
24
|
+
}[];
|
|
25
|
+
static listThemes(): ThemeId[];
|
|
26
|
+
private static readonly KIND_TO_LISTING;
|
|
27
|
+
static catalog(kind: CatalogKind): unknown;
|
|
28
|
+
}
|
|
29
|
+
export {};
|