@mapxus/mapxus-visual-jp 1.8.1 → 1.9.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/bitbucket-pipelines.yml +50 -0
- package/config/rollup.js +33 -0
- package/config/rollup.serve.config.js +3 -0
- package/debug/circlemarker.html +444 -0
- package/debug/create_tags.html +474 -0
- package/debug/distance.html +220 -0
- package/debug/index.html +92 -0
- package/debug/integration.html +1084 -0
- package/debug/leaflet.html +54 -0
- package/debug/markers.html +115 -0
- package/debug/multi_monitor_sync.html +377 -0
- package/debug/outdoor.html +1026 -0
- package/debug/rect_tags.html +147 -0
- package/debug/rotate.html +236 -0
- package/debug/sample.html +324 -0
- package/debug/sequence.html +75 -0
- package/debug/tags.html +218 -0
- package/package.json +34 -10
- package/rollup.config.js +39 -0
- package/server.js +35 -0
- package/spec/api/APIv3.spec.ts +86 -0
- package/spec/component/Component.spec.ts +68 -0
- package/spec/component/StatsComponent.spec.ts +33 -0
- package/spec/component/direction/DirectionComponent.spec.ts +163 -0
- package/spec/component/direction/DirectionDOMRenderer.spec.ts +233 -0
- package/spec/component/keyboard/KeyZoomHandler.spec.ts +236 -0
- package/spec/component/marker/Marker.spec.ts +104 -0
- package/spec/component/marker/MarkerComponent.spec.ts +88 -0
- package/spec/component/marker/MarkerScene.spec.ts +223 -0
- package/spec/component/marker/MarkerSet.spec.ts +453 -0
- package/spec/component/mouse/DoubleClickZoomHandler.spec.ts +211 -0
- package/spec/component/popup/Popup.spec.ts +479 -0
- package/spec/component/popup/PopupComponent.spec.ts +414 -0
- package/spec/component/tag/CreateHandlerBase.spec.ts +83 -0
- package/spec/component/tag/CreatePointHandler.spec.ts +190 -0
- package/spec/component/tag/OutlineRenderTag.spec.ts +91 -0
- package/spec/component/tag/PointGeometry.spec.ts +131 -0
- package/spec/component/tag/PolygonGeometry.spec.ts +497 -0
- package/spec/component/tag/RectGeometry.spec.ts +1157 -0
- package/spec/component/tag/TagComponent.spec.ts +513 -0
- package/spec/component/tag/TagScene.spec.ts +346 -0
- package/spec/component/tag/TagSet.spec.ts +241 -0
- package/spec/component/utils/HandlerBase.spec.ts +203 -0
- package/spec/geo/Camera.spec.ts +250 -0
- package/spec/geo/GeoCoords.spec.ts +364 -0
- package/spec/geo/Spatial.spec.ts +711 -0
- package/spec/geo/Transform.spec.ts +850 -0
- package/spec/geo/ViewportCoords.spec.ts +534 -0
- package/spec/graph/FilterCreator.spec.ts +892 -0
- package/spec/graph/Graph.spec.ts +2078 -0
- package/spec/graph/GraphCalculator.spec.ts +263 -0
- package/spec/graph/GraphService.spec.ts +663 -0
- package/spec/graph/Node.spec.ts +373 -0
- package/spec/graph/NodeCache.spec.ts +206 -0
- package/spec/graph/Sequence.spec.ts +37 -0
- package/spec/graph/edge/EdgeCalculator.Pano.spec.ts +963 -0
- package/spec/graph/edge/EdgeCalculator.Sequence.spec.ts +108 -0
- package/spec/graph/edge/EdgeCalculator.Similar.spec.ts +272 -0
- package/spec/graph/edge/EdgeCalculator.Step.spec.ts +383 -0
- package/spec/graph/edge/EdgeCalculator.Turn.spec.ts +278 -0
- package/spec/graph/edge/EdgeCalculator.spec.ts +747 -0
- package/spec/helper/ContainerMockCreator.spec.ts +33 -0
- package/spec/helper/DOMRendererMockCreator.spec.ts +22 -0
- package/spec/helper/EdgeCalculatorHelper.spec.ts +96 -0
- package/spec/helper/EventHelper.spec.ts +92 -0
- package/spec/helper/GLRendererMockCreator.spec.ts +23 -0
- package/spec/helper/GeoHelper.spec.ts +16 -0
- package/spec/helper/ImageLoadingServiceMockCreator.spec.ts +24 -0
- package/spec/helper/KeyboardServiceMockCreator.spec.ts +21 -0
- package/spec/helper/LoadingServiceMockCreator.spec.ts +21 -0
- package/spec/helper/MockCreator.spec.ts +18 -0
- package/spec/helper/MockCreatorBase.spec.ts +17 -0
- package/spec/helper/MouseServiceMockCreator.spec.ts +38 -0
- package/spec/helper/NavigatorMockCreator.spec.ts +28 -0
- package/spec/helper/NodeHelper.spec.ts +77 -0
- package/spec/helper/NodeMockCreator.spec.ts +19 -0
- package/spec/helper/RenderServiceMockCreator.spec.ts +25 -0
- package/spec/helper/SpriteServiceMockCreator.spec.ts +22 -0
- package/spec/helper/StateServiceMockCreator.spec.ts +33 -0
- package/spec/helper/TouchServiceMockCreator.spec.ts +29 -0
- package/spec/helper/TransformHelper.spec.ts +17 -0
- package/spec/render/DOMRenderer.spec.ts +112 -0
- package/spec/render/GLRenderer.spec.ts +453 -0
- package/spec/render/RenderCamera.spec.ts +535 -0
- package/spec/render/RenderService.spec.ts +531 -0
- package/spec/state/StateBase.spec.ts +369 -0
- package/spec/state/StateService.spec.ts +9 -0
- package/spec/state/TraversingState.spec.ts +262 -0
- package/spec/state/WaitingState.spec.ts +319 -0
- package/spec/tiles/TextureProvider.spec.ts +653 -0
- package/spec/utils/EventEmitter.spec.ts +71 -0
- package/spec/utils/Support.spec.ts +54 -0
- package/spec/viewer/CacheService.spec.ts +160 -0
- package/spec/viewer/ComponentController.spec.ts +310 -0
- package/spec/viewer/LoadingService.spec.ts +19 -0
- package/spec/viewer/MouseService.spec.ts +1344 -0
- package/spec/viewer/Navigator.spec.ts +970 -0
- package/spec/viewer/Observer.spec.ts +96 -0
- package/spec/viewer/SpriteService.spec.ts +224 -0
- package/src/API.ts +3 -0
- package/src/Component.ts +77 -0
- package/src/Edge.ts +6 -0
- package/src/Error.ts +3 -0
- package/src/FilterRender.ts +27 -0
- package/src/Geo.ts +7 -0
- package/src/Graph.ts +19 -0
- package/src/MapxusVisual.ts +66 -0
- package/src/Render.ts +7 -0
- package/src/State.ts +8 -0
- package/src/Support.ts +35 -0
- package/src/Tiles.ts +5 -0
- package/src/Utils.ts +6 -0
- package/src/Viewer.ts +16 -0
- package/src/api/API.ts +396 -0
- package/src/api/Auth.ts +76 -0
- package/src/api/AuthStore.ts +11 -0
- package/src/api/GraphQLCreator.ts +100 -0
- package/src/api/interfaces/IAuth.ts +7 -0
- package/src/api/interfaces/IBuildingBase.ts +7 -0
- package/src/api/interfaces/IBuildingInfo.ts +19 -0
- package/src/api/interfaces/ICoreNode.ts +28 -0
- package/src/api/interfaces/IFillNode.ts +96 -0
- package/src/api/interfaces/IFloorInfo.ts +10 -0
- package/src/api/interfaces/IFullNode.ts +10 -0
- package/src/api/interfaces/IGPano.ts +38 -0
- package/src/api/interfaces/IImageTagInfo.ts +14 -0
- package/src/api/interfaces/IKey.ts +13 -0
- package/src/api/interfaces/ILatLon.ts +19 -0
- package/src/api/interfaces/IOutdoor.ts +14 -0
- package/src/api/interfaces/IPathNode.ts +37 -0
- package/src/api/interfaces/IProject.ts +8 -0
- package/src/api/interfaces/IQueryBuilding.ts +37 -0
- package/src/api/interfaces/IResponse.ts +7 -0
- package/src/api/interfaces/ISequence.ts +16 -0
- package/src/api/interfaces/IUser.ts +13 -0
- package/src/api/interfaces/interfaces.ts +17 -0
- package/src/component/AttributionComponent.ts +48 -0
- package/src/component/BackgroundComponent.ts +39 -0
- package/src/component/BearingComponent.ts +282 -0
- package/src/component/CacheComponent.ts +295 -0
- package/src/component/Component.ts +130 -0
- package/src/component/ComponentService.ts +150 -0
- package/src/component/CoverComponent.ts +132 -0
- package/src/component/DebugComponent.ts +157 -0
- package/src/component/ImageComponent.ts +96 -0
- package/src/component/LoadingComponent.ts +85 -0
- package/src/component/NavigationComponent.ts +233 -0
- package/src/component/RouteComponent.ts +354 -0
- package/src/component/StatsComponent.ts +100 -0
- package/src/component/direction/DirectionComponent.ts +254 -0
- package/src/component/direction/DirectionDOMCalculator.ts +243 -0
- package/src/component/direction/DirectionDOMRenderer.ts +631 -0
- package/src/component/imageplane/ImagePlaneComponent.ts +497 -0
- package/src/component/imageplane/ImagePlaneFactory.ts +314 -0
- package/src/component/imageplane/ImagePlaneGLRenderer.ts +247 -0
- package/src/component/imageplane/ImagePlaneScene.ts +87 -0
- package/src/component/imageplane/ImagePlaneShaders.ts +16 -0
- package/src/component/imageplane/SliderComponent.ts +697 -0
- package/src/component/imageplane/interfaces/IBBoxShaderMaterial.ts +10 -0
- package/src/component/imageplane/interfaces/IShaderMaterial.ts +9 -0
- package/src/component/imageplane/interfaces/interfaces.ts +2 -0
- package/src/component/imageplane/shaders/equirectangular.fragment.glsl.ts +26 -0
- package/src/component/imageplane/shaders/equirectangular.vertex.glsl.ts +15 -0
- package/src/component/imageplane/shaders/perspective.fragment.glsl.ts +27 -0
- package/src/component/imageplane/shaders/perspective.vertex.glsl.ts +15 -0
- package/src/component/interfaces/ICacheConfiguration.ts +72 -0
- package/src/component/interfaces/IComponentConfiguration.ts +5 -0
- package/src/component/interfaces/ICoverConfiguration.ts +15 -0
- package/src/component/interfaces/IDirectionConfiguration.ts +63 -0
- package/src/component/interfaces/IImagePlaneConfiguration.ts +17 -0
- package/src/component/interfaces/IKeyboardConfiguration.ts +44 -0
- package/src/component/interfaces/IMarkerConfiguration.ts +31 -0
- package/src/component/interfaces/IMouseConfiguration.ts +52 -0
- package/src/component/interfaces/INavigationConfiguration.ts +35 -0
- package/src/component/interfaces/IRouteConfiguration.ts +20 -0
- package/src/component/interfaces/ISequenceConfiguration.ts +72 -0
- package/src/component/interfaces/IShader.ts +6 -0
- package/src/component/interfaces/ISliderConfiguration.ts +61 -0
- package/src/component/interfaces/ITagConfiguration.ts +40 -0
- package/src/component/interfaces/interfaces.ts +17 -0
- package/src/component/keyboard/KeySequenceNavigationHandler.ts +86 -0
- package/src/component/keyboard/KeySpatialNavigationHandler.ts +216 -0
- package/src/component/keyboard/KeyZoomHandler.ts +106 -0
- package/src/component/keyboard/KeyboardComponent.ts +125 -0
- package/src/component/marker/Marker.ts +5 -0
- package/src/component/marker/MarkerComponent.ts +856 -0
- package/src/component/marker/MarkerScene.ts +145 -0
- package/src/component/marker/MarkerSet.ts +142 -0
- package/src/component/marker/interfaces/IArrowMarkerOptions.ts +41 -0
- package/src/component/marker/interfaces/ICircleMarkerOptions.ts +30 -0
- package/src/component/marker/interfaces/IDotMarkerOptions.ts +18 -0
- package/src/component/marker/interfaces/IMarkerEvent.ts +28 -0
- package/src/component/marker/interfaces/ISimpleMarkerOptions.ts +54 -0
- package/src/component/marker/interfaces/interfaces.ts +5 -0
- package/src/component/marker/marker/ArrowMarker.ts +84 -0
- package/src/component/marker/marker/CircleMarker.ts +82 -0
- package/src/component/marker/marker/DotMarker.ts +68 -0
- package/src/component/marker/marker/ImageMarker.ts +45 -0
- package/src/component/marker/marker/Marker.ts +99 -0
- package/src/component/marker/marker/SimpleMarker.ts +187 -0
- package/src/component/mouse/BounceHandler.ts +148 -0
- package/src/component/mouse/DoubleClickZoomHandler.ts +106 -0
- package/src/component/mouse/DragPanHandler.ts +489 -0
- package/src/component/mouse/HandlerTypes.ts +13 -0
- package/src/component/mouse/MouseComponent.ts +170 -0
- package/src/component/mouse/ScrollZoomHandler.ts +137 -0
- package/src/component/mouse/TouchZoomHandler.ts +136 -0
- package/src/component/path/PathComponent.ts +75 -0
- package/src/component/path/PathEvent.ts +245 -0
- package/src/component/path/PathMarker.ts +42 -0
- package/src/component/path/PathRender.ts +163 -0
- package/src/component/popup/Popup.ts +2 -0
- package/src/component/popup/PopupComponent.ts +244 -0
- package/src/component/popup/interfaces/IPopupOffset.ts +37 -0
- package/src/component/popup/interfaces/IPopupOptions.ts +81 -0
- package/src/component/popup/popup/Popup.ts +594 -0
- package/src/component/popup/popup/PopupAlignment.ts +3 -0
- package/src/component/sequence/SequenceComponent.ts +500 -0
- package/src/component/sequence/SequenceDOMInteraction.ts +23 -0
- package/src/component/sequence/SequenceDOMRenderer.ts +179 -0
- package/src/component/tag/Tag.ts +9 -0
- package/src/component/tag/TagComponent.ts +787 -0
- package/src/component/tag/TagCreator.ts +138 -0
- package/src/component/tag/TagDOMRenderer.ts +35 -0
- package/src/component/tag/TagMode.ts +37 -0
- package/src/component/tag/TagOperation.ts +7 -0
- package/src/component/tag/TagScene.ts +216 -0
- package/src/component/tag/TagSet.ts +186 -0
- package/src/component/tag/error/GeometryTagError.ts +11 -0
- package/src/component/tag/geometry/Geometry.ts +62 -0
- package/src/component/tag/geometry/PointGeometry.ts +89 -0
- package/src/component/tag/geometry/PolygonGeometry.ts +349 -0
- package/src/component/tag/geometry/RectGeometry.ts +759 -0
- package/src/component/tag/geometry/VertexGeometry.ts +185 -0
- package/src/component/tag/handlers/CreateHandlerBase.ts +81 -0
- package/src/component/tag/handlers/CreatePointHandler.ts +35 -0
- package/src/component/tag/handlers/CreatePolygonHandler.ts +33 -0
- package/src/component/tag/handlers/CreateRectDragHandler.ts +199 -0
- package/src/component/tag/handlers/CreateRectHandler.ts +57 -0
- package/src/component/tag/handlers/CreateVertexHandler.ts +165 -0
- package/src/component/tag/handlers/EditVertexHandler.ts +275 -0
- package/src/component/tag/handlers/TagHandlerBase.ts +57 -0
- package/src/component/tag/interfaces/IInteraction.ts +14 -0
- package/src/component/tag/interfaces/IOutlineCreateTagOptions.ts +15 -0
- package/src/component/tag/interfaces/IOutlineTagOptions.ts +89 -0
- package/src/component/tag/interfaces/ISpotTagOptions.ts +37 -0
- package/src/component/tag/interfaces/interfaces.ts +4 -0
- package/src/component/tag/tag/OutlineCreateTag.ts +330 -0
- package/src/component/tag/tag/OutlineRenderTag.ts +569 -0
- package/src/component/tag/tag/OutlineTag.ts +380 -0
- package/src/component/tag/tag/RenderTag.ts +50 -0
- package/src/component/tag/tag/SpotRenderTag.ts +160 -0
- package/src/component/tag/tag/SpotTag.ts +170 -0
- package/src/component/tag/tag/Tag.ts +103 -0
- package/src/component/utils/HandlerBase.ts +71 -0
- package/src/error/ArgumentBeeviewError.ts +11 -0
- package/src/error/BeeviewError.ts +9 -0
- package/src/error/GraphBeeviewError.ts +11 -0
- package/src/geo/Camera.ts +149 -0
- package/src/geo/GeoCoords.ts +280 -0
- package/src/geo/GeoRBush.ts +25 -0
- package/src/geo/Spatial.ts +259 -0
- package/src/geo/Transform.ts +543 -0
- package/src/geo/ViewportCoords.ts +518 -0
- package/src/geo/interfaces/ILatLonAlt.ts +7 -0
- package/src/geo/interfaces/interfaces.ts +1 -0
- package/src/graph/FilterCreator.ts +106 -0
- package/src/graph/FilterExpression.ts +16 -0
- package/src/graph/Graph.ts +1516 -0
- package/src/graph/GraphCalculator.ts +197 -0
- package/src/graph/GraphService.ts +516 -0
- package/src/graph/ImageLoadingService.ts +44 -0
- package/src/graph/MeshReader.ts +19 -0
- package/src/graph/Node.ts +622 -0
- package/src/graph/NodeCache.ts +548 -0
- package/src/graph/Sequence.ts +117 -0
- package/src/graph/edge/EdgeCalculator.ts +919 -0
- package/src/graph/edge/EdgeCalculatorCoefficients.ts +43 -0
- package/src/graph/edge/EdgeCalculatorDirections.ts +80 -0
- package/src/graph/edge/EdgeCalculatorSettings.ts +61 -0
- package/src/graph/edge/EdgeDirection.ts +63 -0
- package/src/graph/edge/interfaces/IEdge.ts +26 -0
- package/src/graph/edge/interfaces/IEdgeData.ts +22 -0
- package/src/graph/edge/interfaces/IPano.ts +8 -0
- package/src/graph/edge/interfaces/IPotentialEdge.ts +106 -0
- package/src/graph/edge/interfaces/IStep.ts +7 -0
- package/src/graph/edge/interfaces/ITurn.ts +7 -0
- package/src/graph/edge/interfaces/interfaces.ts +6 -0
- package/src/graph/interfaces/IEdgeStatus.ts +25 -0
- package/src/graph/interfaces/IGraphConfiguration.ts +26 -0
- package/src/graph/interfaces/ILoadStatus.ts +18 -0
- package/src/graph/interfaces/ILoadStatusObject.ts +8 -0
- package/src/graph/interfaces/IMesh.ts +20 -0
- package/src/graph/interfaces/interfaces.ts +5 -0
- package/src/render/DOMRenderer.ts +288 -0
- package/src/render/GLRenderStage.ts +6 -0
- package/src/render/GLRenderer.ts +436 -0
- package/src/render/RenderCamera.ts +212 -0
- package/src/render/RenderMode.ts +34 -0
- package/src/render/RenderService.ts +264 -0
- package/src/render/interfaces/IGLRender.ts +10 -0
- package/src/render/interfaces/IGLRenderFunction.ts +10 -0
- package/src/render/interfaces/IGLRenderHash.ts +8 -0
- package/src/render/interfaces/ISize.ts +6 -0
- package/src/render/interfaces/IVNodeHash.ts +8 -0
- package/src/render/interfaces/interfaces.ts +5 -0
- package/src/state/FrameGenerator.ts +36 -0
- package/src/state/State.ts +6 -0
- package/src/state/StateContext.ts +180 -0
- package/src/state/StateService.ts +600 -0
- package/src/state/StateTransitionMatrix.ts +58 -0
- package/src/state/interfaces/ICurrentState.ts +21 -0
- package/src/state/interfaces/IFrame.ts +9 -0
- package/src/state/interfaces/IRotation.ts +6 -0
- package/src/state/interfaces/IState.ts +11 -0
- package/src/state/interfaces/IStateContext.ts +31 -0
- package/src/state/interfaces/interfaces.ts +5 -0
- package/src/state/states/StateBase.ts +425 -0
- package/src/state/states/TraversingState.ts +861 -0
- package/src/state/states/WaitingState.ts +109 -0
- package/src/tiles/ImageTileLoader.ts +121 -0
- package/src/tiles/ImageTileStore.ts +70 -0
- package/src/tiles/RegionOfInterestCalculator.ts +158 -0
- package/src/tiles/TextureProvider.ts +609 -0
- package/src/tiles/interfaces/IBoundingBox.ts +28 -0
- package/src/tiles/interfaces/IRegionOfInterest.ts +25 -0
- package/src/tiles/interfaces/interfaces.ts +2 -0
- package/src/utils/DOM.ts +28 -0
- package/src/utils/EventEmitter.ts +61 -0
- package/src/utils/Func.ts +3 -0
- package/src/utils/Settings.ts +39 -0
- package/src/utils/Support.ts +70 -0
- package/src/utils/Urls.ts +43 -0
- package/src/viewer/Alignment.ts +53 -0
- package/src/viewer/CacheService.ts +75 -0
- package/src/viewer/ComponentController.ts +237 -0
- package/src/viewer/Container.ts +100 -0
- package/src/viewer/EventNames.ts +192 -0
- package/src/viewer/ImageSize.ts +28 -0
- package/src/viewer/KeyboardService.ts +15 -0
- package/src/viewer/LoadingService.ts +66 -0
- package/src/viewer/MouseService.ts +541 -0
- package/src/viewer/Navigator.ts +362 -0
- package/src/viewer/Observer.ts +441 -0
- package/src/viewer/Projection.ts +162 -0
- package/src/viewer/SpriteService.ts +281 -0
- package/src/viewer/TouchService.ts +336 -0
- package/src/viewer/Viewer.ts +1132 -0
- package/src/viewer/interfaces/IComponentOptions.ts +176 -0
- package/src/viewer/interfaces/IMouseClaim.ts +6 -0
- package/src/viewer/interfaces/IMouseDeferPixels.ts +6 -0
- package/src/viewer/interfaces/IPinch.ts +81 -0
- package/src/viewer/interfaces/ISpriteAtlas.ts +12 -0
- package/src/viewer/interfaces/IUnprojection.ts +9 -0
- package/src/viewer/interfaces/IViewerMouseEvent.ts +56 -0
- package/src/viewer/interfaces/IViewerOptions.ts +88 -0
- package/src/viewer/interfaces/PointOfView.ts +19 -0
- package/src/viewer/interfaces/interfaces.ts +9 -0
- package/styles/AttributionComponent.css +26 -0
- package/styles/BackgroundComponent.css +21 -0
- package/styles/BearingComponent.css +48 -0
- package/styles/CoverComponent.css +169 -0
- package/styles/DebugComponent.css +28 -0
- package/styles/DirectionComponent.css +154 -0
- package/styles/LoadingComponent.css +14 -0
- package/styles/NavigationComponent.css +64 -0
- package/styles/NorthBg.png +0 -0
- package/styles/PopupComponent.css +188 -0
- package/styles/RouteComponent.css +21 -0
- package/styles/SequenceComponent.css +120 -0
- package/styles/SliderComponent.css +82 -0
- package/styles/TagComponent.css +105 -0
- package/styles/cover-logo.png +0 -0
- package/styles/mapillary-js.css +29 -0
- package/styles/pano-indicator.svg +3 -0
- package/styles/pano.svg +20 -0
- package/styles/pointer-wheat.svg +3 -0
- package/styles/pointer-white.svg +3 -0
- package/styles/spinner.svg +1 -0
- package/styles/stepper-left.svg +1 -0
- package/styles/stepper-play.svg +1 -0
- package/styles/stepper-right.svg +1 -0
- package/styles/stepper-stop.svg +1 -0
- package/styles/turn-around.svg +3 -0
- package/styles/turn.svg +3 -0
- package/tsconfig.json +28 -0
- package/tslint.json +81 -0
- package/types/graphql/index.d.ts +28 -0
- package/types/graphql/language/ast/index.d.ts +7 -0
- package/types/images/index.d.ts +7 -0
- package/types/pbf/index.d.ts +16 -0
- package/types/rbush/index.d.ts +28 -0
- package/version/beeview-0.1.0.css +2 -0
- package/version/beeview-0.1.0.js +1 -0
- package/version/beeview-0.1.1.css +2 -0
- package/version/beeview-0.1.1.js +1 -0
- package/version/beeview-0.1.2.css +2 -0
- package/version/beeview-0.1.2.js +1 -0
- package/version/beeview-0.2.0.css +2 -0
- package/version/beeview-0.2.0.js +1 -0
- package/version/beeview-0.2.1.css +2 -0
- package/version/beeview-0.2.1.js +1 -0
- package/version/beeview-0.3.0.css +2 -0
- package/version/beeview-0.3.0.js +1 -0
- package/version/beeview-0.4.0.css +2 -0
- package/version/beeview-0.4.0.js +1 -0
- package/version/beeview-0.4.1.css +2 -0
- package/version/beeview-0.4.1.js +1 -0
- package/version/mapxus-visual-1.0.0.css +2 -0
- package/version/mapxus-visual-1.0.0.js +1 -0
- package/version/mapxus-visual-1.1.0.css +2 -0
- package/version/mapxus-visual-1.1.0.js +1 -0
- package/version/mapxus-visual-1.1.1.css +2 -0
- package/version/mapxus-visual-1.1.1.js +1 -0
- package/version/mapxus-visual-1.1.2.css +2 -0
- package/version/mapxus-visual-1.1.2.js +1 -0
- package/version/mapxus-visual-1.2.0.css +2 -0
- package/version/mapxus-visual-1.2.0.js +1 -0
- package/version/mapxus-visual-1.3.0.css +2 -0
- package/version/mapxus-visual-1.3.0.js +1 -0
- package/LICENSE +0 -11
- package/README.md +0 -28
- package/index.css +0 -2
- package/index.d.ts +0 -163
- package/index.js +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as _ from "underscore";
|
|
2
|
+
import { ArgumentBeeviewError } from "../Error";
|
|
3
|
+
import { Container, Navigator } from "../Viewer";
|
|
4
|
+
import { Component } from "./Component";
|
|
5
|
+
import type { CoverComponent } from "./CoverComponent";
|
|
6
|
+
import type { IComponentConfiguration } from "./interfaces/IComponentConfiguration";
|
|
7
|
+
|
|
8
|
+
interface IActiveComponent {
|
|
9
|
+
active: boolean;
|
|
10
|
+
component: Component<IComponentConfiguration>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ComponentService {
|
|
14
|
+
public static registeredCoverComponent: typeof CoverComponent;
|
|
15
|
+
public static registeredComponents: {
|
|
16
|
+
[key: string]: {
|
|
17
|
+
new (...args: any[]): Component<IComponentConfiguration>;
|
|
18
|
+
};
|
|
19
|
+
} = {};
|
|
20
|
+
|
|
21
|
+
private _coverActivated: boolean;
|
|
22
|
+
private _coverComponent: CoverComponent;
|
|
23
|
+
private _components: { [key: string]: IActiveComponent } = {};
|
|
24
|
+
|
|
25
|
+
constructor(container: Container, navigator: Navigator) {
|
|
26
|
+
for (const componentName in ComponentService.registeredComponents) {
|
|
27
|
+
if (
|
|
28
|
+
!ComponentService.registeredComponents.hasOwnProperty(
|
|
29
|
+
componentName,
|
|
30
|
+
)
|
|
31
|
+
) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const component: new (
|
|
36
|
+
...args: any[]
|
|
37
|
+
) => Component<IComponentConfiguration> =
|
|
38
|
+
ComponentService.registeredComponents[componentName];
|
|
39
|
+
|
|
40
|
+
this._components[componentName] = {
|
|
41
|
+
active: false,
|
|
42
|
+
component: new component(componentName, container, navigator),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this._coverComponent = new ComponentService.registeredCoverComponent(
|
|
47
|
+
"cover",
|
|
48
|
+
container,
|
|
49
|
+
navigator,
|
|
50
|
+
);
|
|
51
|
+
this._coverComponent.activate();
|
|
52
|
+
this._coverActivated = true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public static register<
|
|
56
|
+
T extends Component<IComponentConfiguration>,
|
|
57
|
+
>(component: { componentName: string; new (...args: any[]): T }): void {
|
|
58
|
+
if (
|
|
59
|
+
ComponentService.registeredComponents[component.componentName] ===
|
|
60
|
+
undefined
|
|
61
|
+
) {
|
|
62
|
+
ComponentService.registeredComponents[component.componentName] =
|
|
63
|
+
component;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public static registerCover(coverComponent: typeof CoverComponent): void {
|
|
68
|
+
ComponentService.registeredCoverComponent = coverComponent;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public get coverActivated(): boolean {
|
|
72
|
+
return this._coverActivated;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public activateCover(): void {
|
|
76
|
+
if (this._coverActivated) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this._coverActivated = true;
|
|
80
|
+
|
|
81
|
+
for (let component of _.values(this._components)) {
|
|
82
|
+
if (component.active) {
|
|
83
|
+
component.component.deactivate();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public deactivateCover(): void {
|
|
90
|
+
if (!this._coverActivated) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this._coverActivated = false;
|
|
94
|
+
|
|
95
|
+
for (let component of _.values(this._components)) {
|
|
96
|
+
if (component.active) {
|
|
97
|
+
component.component.activate();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public activate(name: string): void {
|
|
104
|
+
this._checkName(name);
|
|
105
|
+
this._components[name].active = true;
|
|
106
|
+
if (!this._coverActivated) {
|
|
107
|
+
this.get(name).activate();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public configure<TConfiguration extends IComponentConfiguration>(
|
|
112
|
+
name: string,
|
|
113
|
+
conf: TConfiguration,
|
|
114
|
+
): void {
|
|
115
|
+
this._checkName(name);
|
|
116
|
+
this.get(name).configure(conf);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public deactivate(name: string): void {
|
|
120
|
+
this._checkName(name);
|
|
121
|
+
this._components[name].active = false;
|
|
122
|
+
if (!this._coverActivated) {
|
|
123
|
+
this.get(name).deactivate();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
public resize(): void {
|
|
128
|
+
for (let component of _.values(this._components)) {
|
|
129
|
+
component.component.resize();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public get<TComponent extends Component<IComponentConfiguration>>(
|
|
134
|
+
name: string,
|
|
135
|
+
): TComponent {
|
|
136
|
+
return <TComponent>this._components[name].component;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public getCover(): CoverComponent {
|
|
140
|
+
return this._coverComponent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private _checkName(name: string): void {
|
|
144
|
+
if (!(name in this._components)) {
|
|
145
|
+
throw new ArgumentBeeviewError(`Component does not exist: ${name}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default ComponentService;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as vd from "virtual-dom";
|
|
2
|
+
import { Subscription } from "rxjs";
|
|
3
|
+
import { Node } from "../graph/Node";
|
|
4
|
+
import { Navigator } from "../viewer/Navigator";
|
|
5
|
+
import { Container } from "../viewer/Container";
|
|
6
|
+
import type { ICoverConfiguration } from "./interfaces/interfaces";
|
|
7
|
+
import { CoverState } from "./interfaces/ICoverConfiguration";
|
|
8
|
+
import { ComponentService } from "./ComponentService";
|
|
9
|
+
import { Component } from "./Component";
|
|
10
|
+
import type { IVNodeHash } from "../render/interfaces/interfaces";
|
|
11
|
+
import { Urls } from "../utils/Urls";
|
|
12
|
+
import { filter, map, withLatestFrom } from "rxjs/operators";
|
|
13
|
+
|
|
14
|
+
export class CoverComponent extends Component<ICoverConfiguration> {
|
|
15
|
+
public static componentName: string = "cover";
|
|
16
|
+
|
|
17
|
+
private _disposable: Subscription;
|
|
18
|
+
private _keyDisposable: Subscription;
|
|
19
|
+
|
|
20
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
21
|
+
super(name, container, navigator);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public _activate(): void {
|
|
25
|
+
this._keyDisposable = this._navigator.stateService.currentNode$
|
|
26
|
+
.pipe(
|
|
27
|
+
withLatestFrom(
|
|
28
|
+
this._configuration$,
|
|
29
|
+
(
|
|
30
|
+
node: Node,
|
|
31
|
+
configuration: ICoverConfiguration,
|
|
32
|
+
): [Node, ICoverConfiguration] => {
|
|
33
|
+
return [node, configuration];
|
|
34
|
+
},
|
|
35
|
+
),
|
|
36
|
+
filter(
|
|
37
|
+
([node, configuration]: [
|
|
38
|
+
Node,
|
|
39
|
+
ICoverConfiguration,
|
|
40
|
+
]): boolean => {
|
|
41
|
+
return node.key !== configuration.key;
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
map(
|
|
45
|
+
([node, configuration]: [
|
|
46
|
+
Node,
|
|
47
|
+
ICoverConfiguration,
|
|
48
|
+
]): Node => {
|
|
49
|
+
return node;
|
|
50
|
+
},
|
|
51
|
+
),
|
|
52
|
+
map((node: Node): ICoverConfiguration => {
|
|
53
|
+
return { key: node.key, src: node.image.src };
|
|
54
|
+
}),
|
|
55
|
+
)
|
|
56
|
+
.subscribe(this._configurationSubject$);
|
|
57
|
+
|
|
58
|
+
this._disposable = this._configuration$
|
|
59
|
+
.pipe(
|
|
60
|
+
map((conf: ICoverConfiguration): IVNodeHash => {
|
|
61
|
+
if (!conf.key) {
|
|
62
|
+
return { name: this._name, vnode: vd.h("div", []) };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (conf.state === CoverState.Hidden) {
|
|
66
|
+
return {
|
|
67
|
+
name: this._name,
|
|
68
|
+
vnode: vd.h("div.Cover.CoverDone", [
|
|
69
|
+
this._getCoverBackgroundVNode(conf),
|
|
70
|
+
]),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
name: this._name,
|
|
76
|
+
vnode: this._getCoverButtonVNode(conf),
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
)
|
|
80
|
+
.subscribe(this._container.domRenderer.render$);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public _deactivate(): void {
|
|
84
|
+
this._disposable.unsubscribe();
|
|
85
|
+
this._keyDisposable.unsubscribe();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
protected _getDefaultConfiguration(): ICoverConfiguration {
|
|
89
|
+
return { state: CoverState.Visible };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private _getCoverButtonVNode(conf: ICoverConfiguration): vd.VNode {
|
|
93
|
+
const cover: string =
|
|
94
|
+
conf.state === CoverState.Loading
|
|
95
|
+
? "div.Cover.CoverLoading"
|
|
96
|
+
: "div.Cover";
|
|
97
|
+
|
|
98
|
+
return vd.h(cover, [
|
|
99
|
+
this._getCoverBackgroundVNode(conf),
|
|
100
|
+
vd.h(
|
|
101
|
+
"button.CoverButton",
|
|
102
|
+
{
|
|
103
|
+
onclick: (): void => {
|
|
104
|
+
this.configure({ state: CoverState.Loading });
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
["Explore"],
|
|
108
|
+
),
|
|
109
|
+
vd.h("a.CoverLogo", { href: ``, target: "" }, []),
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private _getCoverBackgroundVNode(conf: ICoverConfiguration): vd.VNode {
|
|
114
|
+
let url: string =
|
|
115
|
+
conf.src != null ? `url(${conf.src})` : Urls.thumbnail(conf.key);
|
|
116
|
+
|
|
117
|
+
let properties: vd.createProperties = {
|
|
118
|
+
style: { backgroundImage: url },
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
let children: vd.VNode[] = [];
|
|
122
|
+
if (conf.state === CoverState.Loading) {
|
|
123
|
+
children.push(vd.h("div.Logo", {}, []));
|
|
124
|
+
children.push(vd.h("div.LogoText", {}, []));
|
|
125
|
+
}
|
|
126
|
+
children.push(vd.h("div.CoverBackgroundGradient", {}, []));
|
|
127
|
+
return vd.h("div.CoverBackground", properties, children);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ComponentService.registerCover(CoverComponent);
|
|
132
|
+
export default CoverComponent;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as _ from "underscore";
|
|
2
|
+
import * as vd from "virtual-dom";
|
|
3
|
+
import { Subscription, BehaviorSubject } from "rxjs";
|
|
4
|
+
import type { IVNodeHash } from "../render/interfaces/interfaces";
|
|
5
|
+
import type { IFrame } from "../state/interfaces/interfaces";
|
|
6
|
+
import type { IComponentConfiguration } from "./interfaces/interfaces";
|
|
7
|
+
import { Component } from "./Component";
|
|
8
|
+
import { ComponentService } from "./ComponentService";
|
|
9
|
+
import { Container } from "../viewer/Container";
|
|
10
|
+
import { Navigator } from "../viewer/Navigator";
|
|
11
|
+
import { combineLatest } from "rxjs/operators";
|
|
12
|
+
|
|
13
|
+
export class DebugComponent extends Component<IComponentConfiguration> {
|
|
14
|
+
public static componentName: string = "debug";
|
|
15
|
+
|
|
16
|
+
private _displaying: boolean;
|
|
17
|
+
private _disposable: Subscription;
|
|
18
|
+
|
|
19
|
+
private _open$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(
|
|
20
|
+
false,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
24
|
+
super(name, container, navigator);
|
|
25
|
+
this._displaying = false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public _activate(): void {
|
|
29
|
+
this._disposable = this._navigator.stateService.currentState$
|
|
30
|
+
.pipe(
|
|
31
|
+
combineLatest(
|
|
32
|
+
this._open$,
|
|
33
|
+
this._navigator.imageLoadingService.loadstatus$,
|
|
34
|
+
(
|
|
35
|
+
frame: IFrame,
|
|
36
|
+
open: boolean,
|
|
37
|
+
loadStatus: any,
|
|
38
|
+
): IVNodeHash => {
|
|
39
|
+
return {
|
|
40
|
+
name: this._name,
|
|
41
|
+
vnode: this._getDebugVNode(
|
|
42
|
+
open,
|
|
43
|
+
this._getDebugInfo(frame, loadStatus),
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
.subscribe(this._container.domRenderer.render$);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public _deactivate(): void {
|
|
53
|
+
this._disposable.unsubscribe();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected _getDefaultConfiguration(): IComponentConfiguration {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private _getDebugInfo(frame: IFrame, loadStatus: any): vd.VNode[] {
|
|
61
|
+
let ret: vd.VNode[] = [];
|
|
62
|
+
|
|
63
|
+
ret.push(vd.h("h2", "Node"));
|
|
64
|
+
|
|
65
|
+
if (frame.state.currentNode) {
|
|
66
|
+
ret.push(vd.h("p", `currentNode: ${frame.state.currentNode.key}`));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (frame.state.previousNode) {
|
|
70
|
+
ret.push(
|
|
71
|
+
vd.h("p", `previousNode: ${frame.state.previousNode.key}`),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ret.push(vd.h("h2", "Loading"));
|
|
76
|
+
|
|
77
|
+
let total: number = 0;
|
|
78
|
+
let loaded: number = 0;
|
|
79
|
+
let loading: number = 0;
|
|
80
|
+
|
|
81
|
+
for (let loadStat of _.values(loadStatus)) {
|
|
82
|
+
total += loadStat.loaded;
|
|
83
|
+
if (loadStat.loaded !== loadStat.total) {
|
|
84
|
+
loading++;
|
|
85
|
+
} else {
|
|
86
|
+
loaded++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
ret.push(vd.h("p", `Loaded Images: ${loaded}`));
|
|
91
|
+
ret.push(vd.h("p", `Loading Images: ${loading}`));
|
|
92
|
+
ret.push(vd.h("p", `Total bytes loaded: ${total}`));
|
|
93
|
+
|
|
94
|
+
ret.push(vd.h("h2", "Camera"));
|
|
95
|
+
|
|
96
|
+
ret.push(
|
|
97
|
+
vd.h("p", `camera.position.x: ${frame.state.camera.position.x}`),
|
|
98
|
+
);
|
|
99
|
+
ret.push(
|
|
100
|
+
vd.h("p", `camera.position.y: ${frame.state.camera.position.y}`),
|
|
101
|
+
);
|
|
102
|
+
ret.push(
|
|
103
|
+
vd.h("p", `camera.position.z: ${frame.state.camera.position.z}`),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
ret.push(vd.h("p", `camera.lookat.x: ${frame.state.camera.lookat.x}`));
|
|
107
|
+
ret.push(vd.h("p", `camera.lookat.y: ${frame.state.camera.lookat.y}`));
|
|
108
|
+
ret.push(vd.h("p", `camera.lookat.z: ${frame.state.camera.lookat.z}`));
|
|
109
|
+
|
|
110
|
+
ret.push(vd.h("p", `camera.up.x: ${frame.state.camera.up.x}`));
|
|
111
|
+
ret.push(vd.h("p", `camera.up.y: ${frame.state.camera.up.y}`));
|
|
112
|
+
ret.push(vd.h("p", `camera.up.z: ${frame.state.camera.up.z}`));
|
|
113
|
+
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private _getDebugVNode(open: boolean, info: vd.VNode[]): vd.VNode {
|
|
118
|
+
if (open) {
|
|
119
|
+
return vd.h("div.Debug", {}, [
|
|
120
|
+
vd.h("h2", {}, ["Debug"]),
|
|
121
|
+
this._getDebugVNodeButton(open),
|
|
122
|
+
vd.h("pre", {}, info),
|
|
123
|
+
]);
|
|
124
|
+
} else {
|
|
125
|
+
return this._getDebugVNodeButton(open);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private _getDebugVNodeButton(open: boolean): any {
|
|
130
|
+
let buttonText: string = open ? "Disable Debug" : "D";
|
|
131
|
+
let buttonCssClass: string = open ? "" : ".DebugButtonFixed";
|
|
132
|
+
|
|
133
|
+
if (open) {
|
|
134
|
+
return vd.h(
|
|
135
|
+
`button.DebugButton${buttonCssClass}`,
|
|
136
|
+
{ onclick: this._closeDebugElement.bind(this) },
|
|
137
|
+
[buttonText],
|
|
138
|
+
);
|
|
139
|
+
} else {
|
|
140
|
+
return vd.h(
|
|
141
|
+
`button.DebugButton${buttonCssClass}`,
|
|
142
|
+
{ onclick: this._openDebugElement.bind(this) },
|
|
143
|
+
[buttonText],
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private _closeDebugElement(open: boolean): void {
|
|
149
|
+
this._open$.next(false);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private _openDebugElement(): void {
|
|
153
|
+
this._open$.next(true);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default DebugComponent;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as vd from "virtual-dom";
|
|
2
|
+
import {
|
|
3
|
+
Observable,
|
|
4
|
+
Subscription,
|
|
5
|
+
combineLatest as observableCombineLatest,
|
|
6
|
+
} from "rxjs";
|
|
7
|
+
import type { IComponentConfiguration } from "./interfaces/interfaces";
|
|
8
|
+
import { Component } from "./Component";
|
|
9
|
+
import { ComponentService } from "./ComponentService";
|
|
10
|
+
import { Node } from "../graph/Node";
|
|
11
|
+
import type { ISize } from "../render/interfaces/interfaces";
|
|
12
|
+
import { DOM } from "../Utils";
|
|
13
|
+
import { Container } from "../viewer/Container";
|
|
14
|
+
import { Navigator } from "../viewer/Navigator";
|
|
15
|
+
import { distinctUntilChanged, map, filter } from "rxjs/operators";
|
|
16
|
+
|
|
17
|
+
export class ImageComponent extends Component<IComponentConfiguration> {
|
|
18
|
+
public static componentName: string = "image";
|
|
19
|
+
|
|
20
|
+
private _canvasId: string;
|
|
21
|
+
private _dom: DOM;
|
|
22
|
+
private drawSubscription: Subscription;
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
name: string,
|
|
26
|
+
container: Container,
|
|
27
|
+
navigator: Navigator,
|
|
28
|
+
dom?: DOM,
|
|
29
|
+
) {
|
|
30
|
+
super(name, container, navigator);
|
|
31
|
+
|
|
32
|
+
this._canvasId = `${container.id}-${this._name}`;
|
|
33
|
+
this._dom = !!dom ? dom : new DOM();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected _activate(): void {
|
|
37
|
+
const canvasSize$: Observable<[HTMLCanvasElement, ISize]> =
|
|
38
|
+
this._container.domRenderer.element$.pipe(
|
|
39
|
+
map((element: HTMLElement): HTMLCanvasElement => {
|
|
40
|
+
return <HTMLCanvasElement>(
|
|
41
|
+
this._dom.document.getElementById(this._canvasId)
|
|
42
|
+
);
|
|
43
|
+
}),
|
|
44
|
+
filter((canvas: HTMLCanvasElement): boolean => {
|
|
45
|
+
return !!canvas;
|
|
46
|
+
}),
|
|
47
|
+
map((canvas: HTMLCanvasElement): [HTMLCanvasElement, ISize] => {
|
|
48
|
+
const adaptableDomRenderer: HTMLElement =
|
|
49
|
+
canvas.parentElement;
|
|
50
|
+
const width: number = adaptableDomRenderer.offsetWidth;
|
|
51
|
+
const height: number = adaptableDomRenderer.offsetHeight;
|
|
52
|
+
|
|
53
|
+
return [canvas, { height: height, width: width }];
|
|
54
|
+
}),
|
|
55
|
+
distinctUntilChanged(
|
|
56
|
+
(s1: ISize, s2: ISize): boolean => {
|
|
57
|
+
return s1.height === s2.height && s1.width === s2.width;
|
|
58
|
+
},
|
|
59
|
+
([canvas, size]: [HTMLCanvasElement, ISize]): ISize => {
|
|
60
|
+
return size;
|
|
61
|
+
},
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
this.drawSubscription = observableCombineLatest(
|
|
66
|
+
canvasSize$,
|
|
67
|
+
this._navigator.stateService.currentNode$,
|
|
68
|
+
).subscribe(
|
|
69
|
+
([[canvas, size], node]: [
|
|
70
|
+
[HTMLCanvasElement, ISize],
|
|
71
|
+
Node,
|
|
72
|
+
]): void => {
|
|
73
|
+
canvas.width = size.width;
|
|
74
|
+
canvas.height = size.height;
|
|
75
|
+
canvas
|
|
76
|
+
.getContext("2d")
|
|
77
|
+
.drawImage(node.image, 0, 0, size.width, size.height);
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
this._container.domRenderer.renderAdaptive$.next({
|
|
82
|
+
name: this._name,
|
|
83
|
+
vnode: vd.h(`canvas#${this._canvasId}`, []),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected _deactivate(): void {
|
|
88
|
+
this.drawSubscription.unsubscribe();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected _getDefaultConfiguration(): IComponentConfiguration {
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default ImageComponent;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as _ from "underscore";
|
|
2
|
+
import * as vd from "virtual-dom";
|
|
3
|
+
import { Subscription } from "rxjs";
|
|
4
|
+
import { Container } from "../viewer/Container";
|
|
5
|
+
import { Navigator } from "../viewer/Navigator";
|
|
6
|
+
import type { IComponentConfiguration } from "./interfaces/interfaces";
|
|
7
|
+
import { Component } from "./Component";
|
|
8
|
+
import { ComponentService } from "./ComponentService";
|
|
9
|
+
import type { IVNodeHash } from "../render/interfaces/interfaces";
|
|
10
|
+
import { combineLatest } from "rxjs/operators";
|
|
11
|
+
|
|
12
|
+
export class LoadingComponent extends Component<IComponentConfiguration> {
|
|
13
|
+
public static componentName: string = "loading";
|
|
14
|
+
|
|
15
|
+
private _loadingSubscription: Subscription;
|
|
16
|
+
|
|
17
|
+
constructor(name: string, container: Container, navigator: Navigator) {
|
|
18
|
+
super(name, container, navigator);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected _activate(): void {
|
|
22
|
+
this._loadingSubscription = this._navigator.loadingService.loading$
|
|
23
|
+
.pipe(
|
|
24
|
+
combineLatest(
|
|
25
|
+
this._navigator.imageLoadingService.loadstatus$,
|
|
26
|
+
(loading: boolean, loadStatus: any): IVNodeHash => {
|
|
27
|
+
if (!loading) {
|
|
28
|
+
return {
|
|
29
|
+
name: "loading",
|
|
30
|
+
vnode: this._getBarVNode(100),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let total: number = 0;
|
|
35
|
+
let loaded: number = 0;
|
|
36
|
+
|
|
37
|
+
for (let loadStat of _.values(loadStatus)) {
|
|
38
|
+
if (loadStat.loaded !== loadStat.total) {
|
|
39
|
+
loaded += loadStat.loaded;
|
|
40
|
+
total += loadStat.total;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let percentage: number = 100;
|
|
45
|
+
if (total !== 0) {
|
|
46
|
+
percentage = (loaded / total) * 100;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
name: this._name,
|
|
51
|
+
vnode: this._getBarVNode(percentage),
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
.subscribe(this._container.domRenderer.render$);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected _deactivate(): void {
|
|
60
|
+
this._loadingSubscription.unsubscribe();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected _getDefaultConfiguration(): IComponentConfiguration {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private _getBarVNode(percentage: number): vd.VNode {
|
|
68
|
+
let loadingBarStyle: any = {};
|
|
69
|
+
let loadingContainerStyle: any = {};
|
|
70
|
+
|
|
71
|
+
if (percentage !== 100) {
|
|
72
|
+
loadingBarStyle.width = percentage.toFixed(0) + "%";
|
|
73
|
+
loadingBarStyle.opacity = "1";
|
|
74
|
+
} else {
|
|
75
|
+
loadingBarStyle.width = "100%";
|
|
76
|
+
loadingBarStyle.opacity = "0";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return vd.h("div.Loading", { style: loadingContainerStyle }, [
|
|
80
|
+
vd.h("div.LoadingBar", { style: loadingBarStyle }, []),
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default LoadingComponent;
|