@reearth/core 0.0.7-alpha.0 → 0.0.7-alpha.10

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.
Files changed (436) hide show
  1. package/dist/core.js +34320 -34354
  2. package/dist/core.umd.cjs +3868 -3826
  3. package/dist/{index-DqatWUTw.js → index-DqGWVPtz.js} +0 -1
  4. package/dist/index.d.ts +217 -212
  5. package/package.json +8 -8
  6. package/src/Map/ClusteredLayers/index.tsx +2 -2
  7. package/src/Map/Layer/index.tsx +3 -3
  8. package/src/Map/Layers/hooks.ts +10 -0
  9. package/src/Map/Layers/index.tsx +2 -2
  10. package/src/Map/Sketch/hooks.ts +52 -72
  11. package/src/Map/Sketch/index.tsx +2 -24
  12. package/src/Map/Sketch/preset.ts +2 -0
  13. package/src/Map/Sketch/types.ts +31 -0
  14. package/src/Map/hooks.ts +0 -4
  15. package/src/Map/index.tsx +8 -5
  16. package/src/Map/ref.ts +4 -7
  17. package/src/Map/types/index.ts +34 -216
  18. package/src/Map/types/viewerProperty.ts +215 -0
  19. package/src/Map/useTimelineManager.ts +5 -3
  20. package/src/Map/utils.ts +1 -43
  21. package/src/Visualizer/coreContext.tsx +1 -8
  22. package/src/Visualizer/hooks.ts +20 -77
  23. package/src/Visualizer/index.stories.tsx +4 -48
  24. package/src/Visualizer/index.tsx +8 -6
  25. package/src/Visualizer/useCoreAPI.ts +30 -0
  26. package/src/engines/Cesium/Feature/Ellipse/index.stories.tsx +1 -1
  27. package/src/engines/Cesium/Feature/Frustum/index.stories.tsx +1 -1
  28. package/src/engines/Cesium/Feature/Model/index.stories.tsx +1 -1
  29. package/src/engines/Cesium/Feature/Model/index.tsx +10 -9
  30. package/src/engines/Cesium/Feature/Polygon/index.stories.tsx +8 -6
  31. package/src/engines/Cesium/Feature/Raster/index.stories.tsx +2 -2
  32. package/src/engines/Cesium/Feature/Resource/index.stories.tsx +1 -1
  33. package/src/engines/Cesium/Feature/Tileset/hooks.ts +12 -11
  34. package/src/engines/Cesium/Feature/Tileset/index.stories.tsx +1 -1
  35. package/src/engines/Cesium/Feature/Tileset/index.tsx +4 -4
  36. package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +10 -1
  37. package/src/engines/Cesium/Feature/index.tsx +5 -4
  38. package/src/engines/Cesium/Feature/utils.tsx +3 -2
  39. package/src/engines/Cesium/Shaders/OverriddenShaders/GlobeFS/IBL.glsl +6 -10
  40. package/src/engines/Cesium/core/Globe.tsx +36 -68
  41. package/src/engines/Cesium/core/Imagery.test.ts +9 -9
  42. package/src/engines/Cesium/core/Imagery.tsx +17 -19
  43. package/src/engines/Cesium/core/Indicator/Indicator.tsx +8 -8
  44. package/src/engines/Cesium/hooks/useCamera.ts +135 -0
  45. package/src/engines/Cesium/{cameraLimiter.ts → hooks/useCameraLimiter.ts} +22 -45
  46. package/src/engines/Cesium/{useEngineRef.test.tsx → hooks/useEngineRef.test.tsx} +38 -34
  47. package/src/engines/Cesium/{useEngineRef.ts → hooks/useEngineRef.ts} +43 -41
  48. package/src/engines/Cesium/hooks/useExplicitRender.ts +65 -0
  49. package/src/engines/Cesium/hooks/useLayerDragDrop.ts +77 -0
  50. package/src/engines/Cesium/{VertexTerrainElevationMaterial.ts → hooks/useOverrideGlobeShader/VertexTerrainElevationMaterial.ts} +3 -2
  51. package/src/engines/Cesium/{useOverrideGlobeShader.ts → hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts} +20 -17
  52. package/src/engines/Cesium/hooks/useViewerProperty.ts +90 -0
  53. package/src/engines/Cesium/hooks.ts +129 -366
  54. package/src/engines/Cesium/index.stories.tsx +1 -1
  55. package/src/engines/Cesium/index.tsx +60 -62
  56. package/src/engines/index.ts +1 -1
  57. package/src/mantle/atoms/compute.ts +5 -1
  58. package/src/mantle/compat/types.ts +7 -7
  59. package/src/mantle/data/geojson.ts +53 -22
  60. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1
  61. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1
  62. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1
  63. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1
  64. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1
  65. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1
  66. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1
  67. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1
  68. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1
  69. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1
  70. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1
  71. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1
  72. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1
  73. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1
  74. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1
  75. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1
  76. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1
  77. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1
  78. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1
  79. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1
  80. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -1
  81. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1
  82. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1
  83. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1
  84. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1
  85. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1
  86. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1
  87. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1
  88. package/dist/cesium/Assets/Images/bing_maps_credit.png +0 -0
  89. package/dist/cesium/Assets/Images/cesium_credit.png +0 -0
  90. package/dist/cesium/Assets/Images/google_earth_credit.png +0 -0
  91. package/dist/cesium/Assets/Images/ion-credit.png +0 -0
  92. package/dist/cesium/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
  93. package/dist/cesium/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
  94. package/dist/cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
  95. package/dist/cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
  96. package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
  97. package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
  98. package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
  99. package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
  100. package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
  101. package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
  102. package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
  103. package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
  104. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
  105. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
  106. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
  107. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
  108. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
  109. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
  110. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
  111. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
  112. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
  113. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
  114. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
  115. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
  116. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
  117. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
  118. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
  119. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
  120. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
  121. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
  122. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
  123. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
  124. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
  125. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
  126. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
  127. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
  128. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
  129. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
  130. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
  131. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
  132. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
  133. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
  134. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
  135. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
  136. package/dist/cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
  137. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
  138. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
  139. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
  140. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
  141. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
  142. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
  143. package/dist/cesium/Assets/Textures/maki/airfield.png +0 -0
  144. package/dist/cesium/Assets/Textures/maki/airport.png +0 -0
  145. package/dist/cesium/Assets/Textures/maki/alcohol-shop.png +0 -0
  146. package/dist/cesium/Assets/Textures/maki/america-football.png +0 -0
  147. package/dist/cesium/Assets/Textures/maki/art-gallery.png +0 -0
  148. package/dist/cesium/Assets/Textures/maki/bakery.png +0 -0
  149. package/dist/cesium/Assets/Textures/maki/bank.png +0 -0
  150. package/dist/cesium/Assets/Textures/maki/bar.png +0 -0
  151. package/dist/cesium/Assets/Textures/maki/baseball.png +0 -0
  152. package/dist/cesium/Assets/Textures/maki/basketball.png +0 -0
  153. package/dist/cesium/Assets/Textures/maki/beer.png +0 -0
  154. package/dist/cesium/Assets/Textures/maki/bicycle.png +0 -0
  155. package/dist/cesium/Assets/Textures/maki/building.png +0 -0
  156. package/dist/cesium/Assets/Textures/maki/bus.png +0 -0
  157. package/dist/cesium/Assets/Textures/maki/cafe.png +0 -0
  158. package/dist/cesium/Assets/Textures/maki/camera.png +0 -0
  159. package/dist/cesium/Assets/Textures/maki/campsite.png +0 -0
  160. package/dist/cesium/Assets/Textures/maki/car.png +0 -0
  161. package/dist/cesium/Assets/Textures/maki/cemetery.png +0 -0
  162. package/dist/cesium/Assets/Textures/maki/cesium.png +0 -0
  163. package/dist/cesium/Assets/Textures/maki/chemist.png +0 -0
  164. package/dist/cesium/Assets/Textures/maki/cinema.png +0 -0
  165. package/dist/cesium/Assets/Textures/maki/circle-stroked.png +0 -0
  166. package/dist/cesium/Assets/Textures/maki/circle.png +0 -0
  167. package/dist/cesium/Assets/Textures/maki/city.png +0 -0
  168. package/dist/cesium/Assets/Textures/maki/clothing-store.png +0 -0
  169. package/dist/cesium/Assets/Textures/maki/college.png +0 -0
  170. package/dist/cesium/Assets/Textures/maki/commercial.png +0 -0
  171. package/dist/cesium/Assets/Textures/maki/cricket.png +0 -0
  172. package/dist/cesium/Assets/Textures/maki/cross.png +0 -0
  173. package/dist/cesium/Assets/Textures/maki/dam.png +0 -0
  174. package/dist/cesium/Assets/Textures/maki/danger.png +0 -0
  175. package/dist/cesium/Assets/Textures/maki/disability.png +0 -0
  176. package/dist/cesium/Assets/Textures/maki/dog-park.png +0 -0
  177. package/dist/cesium/Assets/Textures/maki/embassy.png +0 -0
  178. package/dist/cesium/Assets/Textures/maki/emergency-telephone.png +0 -0
  179. package/dist/cesium/Assets/Textures/maki/entrance.png +0 -0
  180. package/dist/cesium/Assets/Textures/maki/farm.png +0 -0
  181. package/dist/cesium/Assets/Textures/maki/fast-food.png +0 -0
  182. package/dist/cesium/Assets/Textures/maki/ferry.png +0 -0
  183. package/dist/cesium/Assets/Textures/maki/fire-station.png +0 -0
  184. package/dist/cesium/Assets/Textures/maki/fuel.png +0 -0
  185. package/dist/cesium/Assets/Textures/maki/garden.png +0 -0
  186. package/dist/cesium/Assets/Textures/maki/gift.png +0 -0
  187. package/dist/cesium/Assets/Textures/maki/golf.png +0 -0
  188. package/dist/cesium/Assets/Textures/maki/grocery.png +0 -0
  189. package/dist/cesium/Assets/Textures/maki/hairdresser.png +0 -0
  190. package/dist/cesium/Assets/Textures/maki/harbor.png +0 -0
  191. package/dist/cesium/Assets/Textures/maki/heart.png +0 -0
  192. package/dist/cesium/Assets/Textures/maki/heliport.png +0 -0
  193. package/dist/cesium/Assets/Textures/maki/hospital.png +0 -0
  194. package/dist/cesium/Assets/Textures/maki/ice-cream.png +0 -0
  195. package/dist/cesium/Assets/Textures/maki/industrial.png +0 -0
  196. package/dist/cesium/Assets/Textures/maki/land-use.png +0 -0
  197. package/dist/cesium/Assets/Textures/maki/laundry.png +0 -0
  198. package/dist/cesium/Assets/Textures/maki/library.png +0 -0
  199. package/dist/cesium/Assets/Textures/maki/lighthouse.png +0 -0
  200. package/dist/cesium/Assets/Textures/maki/lodging.png +0 -0
  201. package/dist/cesium/Assets/Textures/maki/logging.png +0 -0
  202. package/dist/cesium/Assets/Textures/maki/london-underground.png +0 -0
  203. package/dist/cesium/Assets/Textures/maki/marker-stroked.png +0 -0
  204. package/dist/cesium/Assets/Textures/maki/marker.png +0 -0
  205. package/dist/cesium/Assets/Textures/maki/minefield.png +0 -0
  206. package/dist/cesium/Assets/Textures/maki/mobilephone.png +0 -0
  207. package/dist/cesium/Assets/Textures/maki/monument.png +0 -0
  208. package/dist/cesium/Assets/Textures/maki/museum.png +0 -0
  209. package/dist/cesium/Assets/Textures/maki/music.png +0 -0
  210. package/dist/cesium/Assets/Textures/maki/oil-well.png +0 -0
  211. package/dist/cesium/Assets/Textures/maki/park.png +0 -0
  212. package/dist/cesium/Assets/Textures/maki/park2.png +0 -0
  213. package/dist/cesium/Assets/Textures/maki/parking-garage.png +0 -0
  214. package/dist/cesium/Assets/Textures/maki/parking.png +0 -0
  215. package/dist/cesium/Assets/Textures/maki/pharmacy.png +0 -0
  216. package/dist/cesium/Assets/Textures/maki/pitch.png +0 -0
  217. package/dist/cesium/Assets/Textures/maki/place-of-worship.png +0 -0
  218. package/dist/cesium/Assets/Textures/maki/playground.png +0 -0
  219. package/dist/cesium/Assets/Textures/maki/police.png +0 -0
  220. package/dist/cesium/Assets/Textures/maki/polling-place.png +0 -0
  221. package/dist/cesium/Assets/Textures/maki/post.png +0 -0
  222. package/dist/cesium/Assets/Textures/maki/prison.png +0 -0
  223. package/dist/cesium/Assets/Textures/maki/rail-above.png +0 -0
  224. package/dist/cesium/Assets/Textures/maki/rail-light.png +0 -0
  225. package/dist/cesium/Assets/Textures/maki/rail-metro.png +0 -0
  226. package/dist/cesium/Assets/Textures/maki/rail-underground.png +0 -0
  227. package/dist/cesium/Assets/Textures/maki/rail.png +0 -0
  228. package/dist/cesium/Assets/Textures/maki/religious-christian.png +0 -0
  229. package/dist/cesium/Assets/Textures/maki/religious-jewish.png +0 -0
  230. package/dist/cesium/Assets/Textures/maki/religious-muslim.png +0 -0
  231. package/dist/cesium/Assets/Textures/maki/restaurant.png +0 -0
  232. package/dist/cesium/Assets/Textures/maki/roadblock.png +0 -0
  233. package/dist/cesium/Assets/Textures/maki/rocket.png +0 -0
  234. package/dist/cesium/Assets/Textures/maki/school.png +0 -0
  235. package/dist/cesium/Assets/Textures/maki/scooter.png +0 -0
  236. package/dist/cesium/Assets/Textures/maki/shop.png +0 -0
  237. package/dist/cesium/Assets/Textures/maki/skiing.png +0 -0
  238. package/dist/cesium/Assets/Textures/maki/slaughterhouse.png +0 -0
  239. package/dist/cesium/Assets/Textures/maki/soccer.png +0 -0
  240. package/dist/cesium/Assets/Textures/maki/square-stroked.png +0 -0
  241. package/dist/cesium/Assets/Textures/maki/square.png +0 -0
  242. package/dist/cesium/Assets/Textures/maki/star-stroked.png +0 -0
  243. package/dist/cesium/Assets/Textures/maki/star.png +0 -0
  244. package/dist/cesium/Assets/Textures/maki/suitcase.png +0 -0
  245. package/dist/cesium/Assets/Textures/maki/swimming.png +0 -0
  246. package/dist/cesium/Assets/Textures/maki/telephone.png +0 -0
  247. package/dist/cesium/Assets/Textures/maki/tennis.png +0 -0
  248. package/dist/cesium/Assets/Textures/maki/theatre.png +0 -0
  249. package/dist/cesium/Assets/Textures/maki/toilets.png +0 -0
  250. package/dist/cesium/Assets/Textures/maki/town-hall.png +0 -0
  251. package/dist/cesium/Assets/Textures/maki/town.png +0 -0
  252. package/dist/cesium/Assets/Textures/maki/triangle-stroked.png +0 -0
  253. package/dist/cesium/Assets/Textures/maki/triangle.png +0 -0
  254. package/dist/cesium/Assets/Textures/maki/village.png +0 -0
  255. package/dist/cesium/Assets/Textures/maki/warehouse.png +0 -0
  256. package/dist/cesium/Assets/Textures/maki/waste-basket.png +0 -0
  257. package/dist/cesium/Assets/Textures/maki/water.png +0 -0
  258. package/dist/cesium/Assets/Textures/maki/wetland.png +0 -0
  259. package/dist/cesium/Assets/Textures/maki/zoo.png +0 -0
  260. package/dist/cesium/Assets/Textures/moonSmall.jpg +0 -0
  261. package/dist/cesium/Assets/Textures/pin.svg +0 -1
  262. package/dist/cesium/Assets/Textures/waterNormals.jpg +0 -0
  263. package/dist/cesium/Assets/Textures/waterNormalsSmall.jpg +0 -0
  264. package/dist/cesium/Assets/approximateTerrainHeights.json +0 -1
  265. package/dist/cesium/ThirdParty/Workers/package.json +0 -1
  266. package/dist/cesium/ThirdParty/Workers/pako_deflate.min.js +0 -1
  267. package/dist/cesium/ThirdParty/Workers/pako_inflate.min.js +0 -1
  268. package/dist/cesium/ThirdParty/Workers/z-worker-pako.js +0 -1
  269. package/dist/cesium/ThirdParty/basis_transcoder.wasm +0 -0
  270. package/dist/cesium/ThirdParty/draco_decoder.wasm +0 -0
  271. package/dist/cesium/ThirdParty/google-earth-dbroot-parser.js +0 -1
  272. package/dist/cesium/Widgets/Animation/Animation.css +0 -127
  273. package/dist/cesium/Widgets/Animation/lighter.css +0 -70
  274. package/dist/cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -108
  275. package/dist/cesium/Widgets/BaseLayerPicker/lighter.css +0 -22
  276. package/dist/cesium/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -102
  277. package/dist/cesium/Widgets/CesiumInspector/CesiumInspector.css +0 -113
  278. package/dist/cesium/Widgets/CesiumWidget/CesiumWidget.css +0 -124
  279. package/dist/cesium/Widgets/CesiumWidget/lighter.css +0 -14
  280. package/dist/cesium/Widgets/FullscreenButton/FullscreenButton.css +0 -8
  281. package/dist/cesium/Widgets/Geocoder/Geocoder.css +0 -70
  282. package/dist/cesium/Widgets/Geocoder/lighter.css +0 -17
  283. package/dist/cesium/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
  284. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
  285. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
  286. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
  287. package/dist/cesium/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
  288. package/dist/cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
  289. package/dist/cesium/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
  290. package/dist/cesium/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
  291. package/dist/cesium/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
  292. package/dist/cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
  293. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
  294. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
  295. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
  296. package/dist/cesium/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
  297. package/dist/cesium/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
  298. package/dist/cesium/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
  299. package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
  300. package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
  301. package/dist/cesium/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
  302. package/dist/cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
  303. package/dist/cesium/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
  304. package/dist/cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
  305. package/dist/cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
  306. package/dist/cesium/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
  307. package/dist/cesium/Widgets/Images/NavigationHelp/Touch.svg +0 -120
  308. package/dist/cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
  309. package/dist/cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
  310. package/dist/cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
  311. package/dist/cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
  312. package/dist/cesium/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
  313. package/dist/cesium/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
  314. package/dist/cesium/Widgets/Images/TimelineIcons.png +0 -0
  315. package/dist/cesium/Widgets/Images/info-loading.gif +0 -0
  316. package/dist/cesium/Widgets/InfoBox/InfoBox.css +0 -92
  317. package/dist/cesium/Widgets/InfoBox/InfoBoxDescription.css +0 -178
  318. package/dist/cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -93
  319. package/dist/cesium/Widgets/NavigationHelpButton/lighter.css +0 -38
  320. package/dist/cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
  321. package/dist/cesium/Widgets/ProjectionPicker/ProjectionPicker.css +0 -38
  322. package/dist/cesium/Widgets/SceneModePicker/SceneModePicker.css +0 -56
  323. package/dist/cesium/Widgets/SelectionIndicator/SelectionIndicator.css +0 -20
  324. package/dist/cesium/Widgets/Timeline/Timeline.css +0 -103
  325. package/dist/cesium/Widgets/Timeline/lighter.css +0 -23
  326. package/dist/cesium/Widgets/VRButton/VRButton.css +0 -8
  327. package/dist/cesium/Widgets/Viewer/Viewer.css +0 -107
  328. package/dist/cesium/Widgets/VoxelInspector/VoxelInspector.css +0 -16
  329. package/dist/cesium/Widgets/lighter.css +0 -237
  330. package/dist/cesium/Widgets/lighterShared.css +0 -46
  331. package/dist/cesium/Widgets/shared.css +0 -103
  332. package/dist/cesium/Widgets/widgets.css +0 -1346
  333. package/dist/cesium/Workers/chunk-2ED5WI77.js +0 -26
  334. package/dist/cesium/Workers/chunk-2MBPFWCP.js +0 -26
  335. package/dist/cesium/Workers/chunk-3C74MLG3.js +0 -26
  336. package/dist/cesium/Workers/chunk-45U7TTT3.js +0 -26
  337. package/dist/cesium/Workers/chunk-4N7SRDH5.js +0 -26
  338. package/dist/cesium/Workers/chunk-4T6AS6BZ.js +0 -26
  339. package/dist/cesium/Workers/chunk-5AG2MVRM.js +0 -26
  340. package/dist/cesium/Workers/chunk-5Z6L2FHX.js +0 -26
  341. package/dist/cesium/Workers/chunk-6AUUBDOF.js +0 -26
  342. package/dist/cesium/Workers/chunk-74N6MC2V.js +0 -26
  343. package/dist/cesium/Workers/chunk-7VJK3KHI.js +0 -26
  344. package/dist/cesium/Workers/chunk-7VZHIB6P.js +0 -26
  345. package/dist/cesium/Workers/chunk-7X2YQ6I4.js +0 -27
  346. package/dist/cesium/Workers/chunk-B2SKQ7LU.js +0 -26
  347. package/dist/cesium/Workers/chunk-B4TQDFIE.js +0 -26
  348. package/dist/cesium/Workers/chunk-B6TRTFAA.js +0 -26
  349. package/dist/cesium/Workers/chunk-BK3HCS7I.js +0 -26
  350. package/dist/cesium/Workers/chunk-BOPB43LN.js +0 -26
  351. package/dist/cesium/Workers/chunk-C6DMEJQ7.js +0 -26
  352. package/dist/cesium/Workers/chunk-CN7UN2OZ.js +0 -26
  353. package/dist/cesium/Workers/chunk-CSISXEG7.js +0 -26
  354. package/dist/cesium/Workers/chunk-CUOR5F7T.js +0 -28
  355. package/dist/cesium/Workers/chunk-DGCK3LD2.js +0 -30
  356. package/dist/cesium/Workers/chunk-DXEZYE3K.js +0 -62
  357. package/dist/cesium/Workers/chunk-EXBFEYPQ.js +0 -26
  358. package/dist/cesium/Workers/chunk-FK5KFB6H.js +0 -26
  359. package/dist/cesium/Workers/chunk-HPBHKP5S.js +0 -26
  360. package/dist/cesium/Workers/chunk-JCJ24DHF.js +0 -26
  361. package/dist/cesium/Workers/chunk-JEWHFDAA.js +0 -26
  362. package/dist/cesium/Workers/chunk-JZLZJJQD.js +0 -26
  363. package/dist/cesium/Workers/chunk-KRZBI2MU.js +0 -26
  364. package/dist/cesium/Workers/chunk-KTTUANTJ.js +0 -26
  365. package/dist/cesium/Workers/chunk-LDCAXLGS.js +0 -26
  366. package/dist/cesium/Workers/chunk-LOPN5R3I.js +0 -26
  367. package/dist/cesium/Workers/chunk-MDLPQIMP.js +0 -26
  368. package/dist/cesium/Workers/chunk-MRR3RGFO.js +0 -26
  369. package/dist/cesium/Workers/chunk-NPBZI5YA.js +0 -26
  370. package/dist/cesium/Workers/chunk-NUSW5B6A.js +0 -26
  371. package/dist/cesium/Workers/chunk-OUXRUXNB.js +0 -26
  372. package/dist/cesium/Workers/chunk-QPOPEH3M.js +0 -26
  373. package/dist/cesium/Workers/chunk-R2AN7EKC.js +0 -26
  374. package/dist/cesium/Workers/chunk-RURL6ZX2.js +0 -26
  375. package/dist/cesium/Workers/chunk-SUQM3OSW.js +0 -28
  376. package/dist/cesium/Workers/chunk-UBIRX2SP.js +0 -26
  377. package/dist/cesium/Workers/chunk-VAKC5J5C.js +0 -26
  378. package/dist/cesium/Workers/chunk-VHNZBQTR.js +0 -27
  379. package/dist/cesium/Workers/chunk-VKV642QV.js +0 -26
  380. package/dist/cesium/Workers/chunk-VMSXG4OA.js +0 -26
  381. package/dist/cesium/Workers/chunk-VQZSIOZW.js +0 -26
  382. package/dist/cesium/Workers/chunk-WZUWQMI7.js +0 -26
  383. package/dist/cesium/Workers/chunk-YBI55DLZ.js +0 -26
  384. package/dist/cesium/Workers/chunk-YEJWCH6C.js +0 -26
  385. package/dist/cesium/Workers/chunk-YPDO7SPO.js +0 -26
  386. package/dist/cesium/Workers/chunk-ZYWD6OQH.js +0 -26
  387. package/dist/cesium/Workers/combineGeometry.js +0 -26
  388. package/dist/cesium/Workers/createBoxGeometry.js +0 -26
  389. package/dist/cesium/Workers/createBoxOutlineGeometry.js +0 -26
  390. package/dist/cesium/Workers/createCircleGeometry.js +0 -26
  391. package/dist/cesium/Workers/createCircleOutlineGeometry.js +0 -26
  392. package/dist/cesium/Workers/createCoplanarPolygonGeometry.js +0 -26
  393. package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
  394. package/dist/cesium/Workers/createCorridorGeometry.js +0 -26
  395. package/dist/cesium/Workers/createCorridorOutlineGeometry.js +0 -26
  396. package/dist/cesium/Workers/createCylinderGeometry.js +0 -26
  397. package/dist/cesium/Workers/createCylinderOutlineGeometry.js +0 -26
  398. package/dist/cesium/Workers/createEllipseGeometry.js +0 -26
  399. package/dist/cesium/Workers/createEllipseOutlineGeometry.js +0 -26
  400. package/dist/cesium/Workers/createEllipsoidGeometry.js +0 -26
  401. package/dist/cesium/Workers/createEllipsoidOutlineGeometry.js +0 -26
  402. package/dist/cesium/Workers/createFrustumGeometry.js +0 -26
  403. package/dist/cesium/Workers/createFrustumOutlineGeometry.js +0 -26
  404. package/dist/cesium/Workers/createGeometry.js +0 -26
  405. package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
  406. package/dist/cesium/Workers/createPlaneGeometry.js +0 -26
  407. package/dist/cesium/Workers/createPlaneOutlineGeometry.js +0 -26
  408. package/dist/cesium/Workers/createPolygonGeometry.js +0 -26
  409. package/dist/cesium/Workers/createPolygonOutlineGeometry.js +0 -26
  410. package/dist/cesium/Workers/createPolylineGeometry.js +0 -26
  411. package/dist/cesium/Workers/createPolylineVolumeGeometry.js +0 -26
  412. package/dist/cesium/Workers/createPolylineVolumeOutlineGeometry.js +0 -26
  413. package/dist/cesium/Workers/createRectangleGeometry.js +0 -26
  414. package/dist/cesium/Workers/createRectangleOutlineGeometry.js +0 -26
  415. package/dist/cesium/Workers/createSimplePolylineGeometry.js +0 -26
  416. package/dist/cesium/Workers/createSphereGeometry.js +0 -26
  417. package/dist/cesium/Workers/createSphereOutlineGeometry.js +0 -26
  418. package/dist/cesium/Workers/createTaskProcessorWorker.js +0 -26
  419. package/dist/cesium/Workers/createVectorTileClampedPolylines.js +0 -26
  420. package/dist/cesium/Workers/createVectorTileGeometries.js +0 -26
  421. package/dist/cesium/Workers/createVectorTilePoints.js +0 -26
  422. package/dist/cesium/Workers/createVectorTilePolygons.js +0 -26
  423. package/dist/cesium/Workers/createVectorTilePolylines.js +0 -26
  424. package/dist/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -26
  425. package/dist/cesium/Workers/createVerticesFromHeightmap.js +0 -26
  426. package/dist/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -26
  427. package/dist/cesium/Workers/createWallGeometry.js +0 -26
  428. package/dist/cesium/Workers/createWallOutlineGeometry.js +0 -26
  429. package/dist/cesium/Workers/decodeDraco.js +0 -26
  430. package/dist/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +0 -26
  431. package/dist/cesium/Workers/decodeI3S.js +0 -26
  432. package/dist/cesium/Workers/transcodeKTX2.js +0 -56
  433. package/dist/cesium/Workers/transferTypedArrayTest.js +0 -26
  434. package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
  435. /package/src/engines/Cesium/{JapanSeaLevelEllipsoid.ts → hooks/useOverrideGlobeShader/JapanSeaLevelEllipsoid.ts} +0 -0
  436. /package/src/engines/Cesium/{vertexTerrainElevationMaterial.glsl → hooks/useOverrideGlobeShader/vertexTerrainElevationMaterial.glsl} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.0",
3
+ "version": "0.0.7-alpha.10",
4
4
  "author": "Re:Earth contributors <community@reearth.io>",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A library that abstracts a map engine as one common API.",
@@ -27,9 +27,9 @@
27
27
  "node": ">=20"
28
28
  },
29
29
  "peerDependencies": {
30
+ "cesium": "1.118.x",
30
31
  "react": "^18.2.0",
31
- "react-dom": "^18.2.0",
32
- "cesium": "1.x"
32
+ "react-dom": "^18.2.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "@reearth/cesium-mvt-imagery-provider": "1.5.4",
@@ -61,7 +61,7 @@
61
61
  "react-error-boundary": "4.0.11",
62
62
  "react-nl2br": "1.0.4",
63
63
  "react-use": "17.5.0",
64
- "resium": "1.17.4",
64
+ "resium": "1.18.1",
65
65
  "suspend-react": "0.1.3",
66
66
  "tiny-invariant": "1.3.3",
67
67
  "use-callback-ref": "1.3.2",
@@ -89,13 +89,13 @@
89
89
  "@types/lodash-es": "4.17.12",
90
90
  "@types/node": "20.12.7",
91
91
  "@types/pbf": "3.0.5",
92
- "@types/react": "18.2.6",
93
- "@types/react-dom": "18.2.6",
92
+ "@types/react": "18.3.0",
93
+ "@types/react-dom": "18.3.0",
94
94
  "@types/uuid": "9.0.8",
95
95
  "@typescript-eslint/eslint-plugin": "7.2.0",
96
96
  "@typescript-eslint/parser": "7.2.0",
97
97
  "@vitejs/plugin-react": "4.2.1",
98
- "cesium": "1.116.0",
98
+ "cesium": "1.118.0",
99
99
  "eslint": "8.57.0",
100
100
  "eslint-config-reearth": "0.3.0",
101
101
  "eslint-plugin-react-hooks": "4.6.0",
@@ -108,7 +108,7 @@
108
108
  "storybook": "8.0.8",
109
109
  "typescript": "5.2.2",
110
110
  "vite": "5.0.8",
111
- "vite-plugin-cesium": "1.2.22",
111
+ "vite-plugin-cesium": "1.2.23",
112
112
  "vite-plugin-dts": "3.8.1",
113
113
  "vite-plugin-svgr": "4.2.0",
114
114
  "vite-tsconfig-paths": "^4.3.2",
@@ -1,7 +1,7 @@
1
1
  import { ComponentType, useMemo, useCallback, ReactNode } from "react";
2
2
 
3
3
  import LayerComponent, { type CommonProps, type Props as LayerProps } from "../Layer";
4
- import type { Layer, Atom, Typography, DataType } from "../types";
4
+ import type { Layer, Atom, Typography, DataType, ViewerProperty } from "../types";
5
5
 
6
6
  export type Props = {
7
7
  layers?: Layer[];
@@ -14,7 +14,7 @@ export type Props = {
14
14
  isHidden?: (id: string) => boolean;
15
15
  clusters?: Cluster[];
16
16
  delegatedDataTypes?: DataType[];
17
- sceneProperty?: any;
17
+ viewerProperty?: ViewerProperty;
18
18
  clusterComponent?: ClusterComponentType;
19
19
  Feature?: LayerProps["Feature"];
20
20
  } & Omit<CommonProps, "isSelected" | "isHidden" | "selectedFeatureId">;
@@ -9,7 +9,7 @@ import type {
9
9
  ComputedFeature,
10
10
  LayerSimple,
11
11
  } from "../../mantle";
12
- import { SceneProperty } from "../types";
12
+ import { ViewerProperty } from "../types";
13
13
 
14
14
  import useHooks, { type Atom, type EvalFeature } from "./hooks";
15
15
 
@@ -29,7 +29,7 @@ export type CommonProps = {
29
29
 
30
30
  export type FeatureComponentProps = {
31
31
  layer: ComputedLayer;
32
- sceneProperty?: SceneProperty;
32
+ viewerProperty?: ViewerProperty;
33
33
  onFeatureRequest?: (range: DataRange) => void;
34
34
  onLayerFetch?: (value: Partial<Pick<LayerSimple, "properties">>) => void;
35
35
  onFeatureFetch?: (features: Feature[]) => void;
@@ -44,7 +44,7 @@ export type Props = {
44
44
  atom?: Atom;
45
45
  overrides?: Record<string, any>;
46
46
  delegatedDataTypes?: DataType[];
47
- sceneProperty?: any;
47
+ viewerProperty?: ViewerProperty;
48
48
  selectedFeatureId?: string;
49
49
  /** Feature component should be injected by a map engine. */
50
50
  Feature?: ComponentType<FeatureComponentProps>;
@@ -52,6 +52,7 @@ export type Ref = {
52
52
  override: (id: string, layer?: (Partial<Layer> & { property?: any }) | null) => void;
53
53
  deleteLayer: (...ids: string[]) => void;
54
54
  isLayer: (obj: any) => obj is LazyLayer;
55
+ isComputedLayer: (obj: any) => obj is ComputedLayer;
55
56
  layers: () => LazyLayer[];
56
57
  walk: <T>(
57
58
  fn: (layer: LazyLayer, index: number, parents: LazyLayer[]) => T | void,
@@ -455,6 +456,13 @@ export default function useHooks({
455
456
  [lazyLayerPrototype],
456
457
  );
457
458
 
459
+ const isComputedLayer = useCallback(
460
+ (obj: any): obj is ComputedLayer => {
461
+ return typeof obj === "object" && Object.getPrototypeOf(obj) === lazyComputedLayerPrototype;
462
+ },
463
+ [lazyComputedLayerPrototype],
464
+ );
465
+
458
466
  const rootLayers = useCallback(() => {
459
467
  return [...(layersRef() ?? []), ...tempLayersRef.current]
460
468
  .map(l => findById(l.id))
@@ -551,6 +559,7 @@ export default function useHooks({
551
559
  deleteLayer,
552
560
  findByIds,
553
561
  isLayer,
562
+ isComputedLayer,
554
563
  layers: rootLayers,
555
564
  walk,
556
565
  find,
@@ -575,6 +584,7 @@ export default function useHooks({
575
584
  deleteLayer,
576
585
  findByIds,
577
586
  isLayer,
587
+ isComputedLayer,
578
588
  rootLayers,
579
589
  walk,
580
590
  find,
@@ -2,7 +2,7 @@ import { forwardRef, RefObject, type ForwardRefRenderFunction, type MutableRefOb
2
2
 
3
3
  import { SelectedFeatureInfo } from "../../mantle";
4
4
  import ClusteredLayers, { type Props as ClusteredLayerProps } from "../ClusteredLayers";
5
- import type { ComputedLayer, EngineRef, RequestingRenderMode } from "../types";
5
+ import type { ComputedLayer, EngineRef, RequestingRenderMode, ViewerProperty } from "../types";
6
6
 
7
7
  import useHooks, { LayerSelectionReason, type Ref } from "./hooks";
8
8
 
@@ -36,7 +36,7 @@ export type Props = Omit<ClusteredLayerProps, "atomMap" | "isHidden" | "selected
36
36
  reason?: LayerSelectionReason;
37
37
  };
38
38
  hiddenLayers?: string[];
39
- sceneProperty?: any;
39
+ viewerProperty?: ViewerProperty;
40
40
  requestingRenderMode?: MutableRefObject<RequestingRenderMode>;
41
41
  engineRef?: RefObject<EngineRef>;
42
42
  onLayerSelect?: (
@@ -24,15 +24,16 @@ import {
24
24
  MouseEventProps,
25
25
  SketchRef,
26
26
  } from "../types";
27
+ import { useGet } from "../utils";
27
28
 
28
- import { PRESET_APPEARANCE } from "./preset";
29
+ import { PRESET_APPEARANCE, PRESET_COLOR } from "./preset";
29
30
  import { Position3d, createSketchMachine } from "./sketchMachine";
30
31
  import {
31
32
  GeometryOptionsXYZ,
32
33
  SketchType,
33
34
  SketchFeature,
34
- SketchAppearance,
35
35
  SketchEventProps,
36
+ SketchOptions,
36
37
  } from "./types";
37
38
  import { useWindowEvent } from "./utils";
38
39
 
@@ -73,16 +74,25 @@ export default function useHooks({
73
74
  const [state, send] = useMachine(sketchMachine);
74
75
  const [type, updateType] = useState<SketchType | undefined>();
75
76
  const [from, updateFrom] = useState<"editor" | "plugin">("editor");
76
- const [color, updateColor] = useState<string>();
77
- const [disableShadow, updateDisableShadow] = useState(false);
78
- const [enableRelativeHeight, updateEnableRelativeHeight] = useState(false);
79
77
  const [disableInteraction, setDisableInteraction] = useState(false);
80
- const [defaultAppearance, updateDefaultAppearance] = useState<SketchAppearance | undefined>(
81
- PRESET_APPEARANCE,
82
- );
83
- const createDataOnlyForPluginEnabledRef = useRef(false);
84
- const allowRightClickToAbortEnabledRef = useRef(true);
85
- const allowAutoResetInteractionModeRef = useRef(true);
78
+
79
+ const [sketchOptions, setSketchOptions] = useState<SketchOptions>({
80
+ color: PRESET_COLOR,
81
+ appearance: PRESET_APPEARANCE,
82
+ dataOnly: false,
83
+ disableShadow: false,
84
+ enableRelativeHeight: false,
85
+ rightClickToAbort: true,
86
+ autoResetInteractionMode: true,
87
+ });
88
+
89
+ const overrideOptions = useCallback((options: SketchOptions) => {
90
+ setSketchOptions(prev => ({
91
+ ...prev,
92
+ ...options,
93
+ appearance: merge(cloneDeep(prev.appearance), options.appearance),
94
+ }));
95
+ }, []);
86
96
 
87
97
  const [geometryOptions, setGeometryOptions] = useState<GeometryOptionsXYZ | null>(null);
88
98
  const [extrudedHeight, setExtrudedHeight] = useState(0);
@@ -94,34 +104,6 @@ export default function useHooks({
94
104
  updateFrom(from ?? "editor");
95
105
  }, []);
96
106
 
97
- const setColor = useCallback((color: string) => {
98
- updateColor(color);
99
- }, []);
100
-
101
- const setDisableShadow = useCallback((disable: boolean) => {
102
- updateDisableShadow(!!disable);
103
- }, []);
104
-
105
- const setEnableRelativeHeight = useCallback((enable: boolean) => {
106
- updateEnableRelativeHeight(!!enable);
107
- }, []);
108
-
109
- const setDefaultAppearance = useCallback((appearance: SketchAppearance) => {
110
- updateDefaultAppearance(merge(cloneDeep(PRESET_APPEARANCE), appearance));
111
- }, []);
112
-
113
- const createDataOnly = useCallback((dataOnly: boolean) => {
114
- createDataOnlyForPluginEnabledRef.current = !!dataOnly;
115
- }, []);
116
-
117
- const allowRightClickToAbort = useCallback((allow: boolean) => {
118
- allowRightClickToAbortEnabledRef.current = !!allow;
119
- }, []);
120
-
121
- const allowAutoResetInteractionMode = useCallback((allow: boolean) => {
122
- allowAutoResetInteractionModeRef.current = !!allow;
123
- }, []);
124
-
125
107
  const createFeature = useCallback(() => {
126
108
  const geoOptions = type === "marker" ? markerGeometryRef.current : geometryOptions;
127
109
  if (geoOptions == null) {
@@ -169,11 +151,11 @@ export default function useHooks({
169
151
  features: [{ ...feature, id: feature.properties.id }],
170
152
  },
171
153
  },
172
- ...defaultAppearance,
154
+ ...sketchOptions.appearance,
173
155
  });
174
156
  return { layerId: newLayer?.id, featureId: feature.properties.id };
175
157
  },
176
- [layersRef, defaultAppearance],
158
+ [layersRef, sketchOptions.appearance],
177
159
  );
178
160
 
179
161
  const pluginSketchLayerFeatureAdd = useCallback(
@@ -220,13 +202,16 @@ export default function useHooks({
220
202
 
221
203
  const handleFeatureCreate = useCallback(
222
204
  (feature: SketchFeature) => {
223
- updateType(undefined);
205
+ if (sketchOptions.autoResetInteractionMode) {
206
+ updateType(undefined);
207
+ }
208
+
224
209
  if (from === "editor") {
225
210
  onSketchFeatureCreate?.(feature);
226
211
  return;
227
212
  }
228
213
 
229
- if (!createDataOnlyForPluginEnabledRef.current) {
214
+ if (!sketchOptions.dataOnly) {
230
215
  const selectedLayer = layersRef.current?.selectedLayer();
231
216
  const { layerId, featureId } =
232
217
  selectedLayer?.id?.length !== PLUGIN_LAYER_ID_LENGTH ||
@@ -262,6 +247,8 @@ export default function useHooks({
262
247
  [
263
248
  layersRef,
264
249
  from,
250
+ sketchOptions.dataOnly,
251
+ sketchOptions.autoResetInteractionMode,
265
252
  pluginSketchLayerCreate,
266
253
  pluginSketchLayerFeatureAdd,
267
254
  onSketchFeatureCreate,
@@ -481,7 +468,7 @@ export default function useHooks({
481
468
  );
482
469
 
483
470
  const handleRightClick = useCallback(() => {
484
- if (!allowRightClickToAbortEnabledRef.current) {
471
+ if (!sketchOptions.rightClickToAbort) {
485
472
  return;
486
473
  }
487
474
  if (type !== undefined) {
@@ -490,7 +477,7 @@ export default function useHooks({
490
477
  if (state.matches("idle")) return;
491
478
  send({ type: "ABORT" });
492
479
  updateGeometryOptions(undefined);
493
- }, [type, state, send, updateGeometryOptions]);
480
+ }, [type, state, sketchOptions.rightClickToAbort, send, updateGeometryOptions]);
494
481
 
495
482
  const mouseDownEventRef = useRef<MouseEventCallback>(handleLeftDown);
496
483
  mouseDownEventRef.current = handleLeftDown;
@@ -583,47 +570,40 @@ export default function useHooks({
583
570
  }
584
571
  }, [type, send, updateGeometryOptions]);
585
572
 
573
+ const fromRef = useRef(from);
574
+ fromRef.current = from;
575
+ const overrideInteractionModeRef = useRef(overrideInteractionMode);
576
+ overrideInteractionModeRef.current = overrideInteractionMode;
577
+ const onSketchTypeChangeRef = useRef(onSketchTypeChange);
578
+ onSketchTypeChangeRef.current = onSketchTypeChange;
579
+
586
580
  useEffect(() => {
587
- if (type) {
588
- overrideInteractionMode?.("sketch");
589
- } else if (allowAutoResetInteractionModeRef.current) {
590
- overrideInteractionMode?.("default");
591
- }
581
+ overrideInteractionModeRef.current?.(type ? "sketch" : "default");
582
+ onSketchTypeChangeRef.current?.(type, fromRef.current);
583
+ }, [type]);
592
584
 
593
- onSketchTypeChange?.(type, from);
594
- }, [type, from, overrideInteractionMode, onSketchTypeChange]);
585
+ // API
586
+ const getType = useGet(type);
587
+ const getOptions = useGet(sketchOptions);
595
588
 
596
589
  useImperativeHandle(
597
590
  ref,
598
591
  () => ({
592
+ getType,
599
593
  setType,
600
- setColor,
601
- setDefaultAppearance,
602
- createDataOnly,
603
- disableShadow: setDisableShadow,
604
- enableRelativeHeight: setEnableRelativeHeight,
605
- allowRightClickToAbort,
606
- allowAutoResetInteractionMode,
594
+ getOptions,
595
+ overrideOptions,
607
596
  }),
608
- [
609
- setType,
610
- setColor,
611
- setDisableShadow,
612
- setEnableRelativeHeight,
613
- setDefaultAppearance,
614
- createDataOnly,
615
- allowRightClickToAbort,
616
- allowAutoResetInteractionMode,
617
- ],
597
+ [getType, setType, getOptions, overrideOptions],
618
598
  );
619
599
 
620
600
  return {
621
601
  state,
622
602
  extrudedHeight,
623
603
  geometryOptions,
624
- color,
625
- disableShadow,
626
- enableRelativeHeight,
604
+ color: sketchOptions.color,
605
+ disableShadow: sketchOptions.disableShadow,
606
+ enableRelativeHeight: sketchOptions.enableRelativeHeight,
627
607
  } as any;
628
608
  }
629
609
 
@@ -1,38 +1,16 @@
1
1
  // Reference: Sketch feature is basically referenced from https://github.com/takram-design-engineering/plateau-view/blob/main/libs/sketch/src/SketchTool.tsx
2
2
 
3
- import { type LineString, type MultiPolygon, type Polygon } from "geojson";
4
- import { ComponentType, ForwardRefRenderFunction, RefObject, forwardRef } from "react";
5
- import { RequireExactlyOne } from "type-fest";
3
+ import { ForwardRefRenderFunction, RefObject, forwardRef } from "react";
6
4
 
7
5
  import { ComputedLayer, SelectedFeatureInfo } from "../../mantle";
8
- import { Position3d } from "../../types";
9
6
  import { InteractionModeType } from "../../Visualizer/interactionMode";
10
7
  import { EngineRef, Feature, LayerSelectionReason, LayersRef, SketchRef } from "../types";
11
8
 
12
9
  import useHooks from "./hooks";
13
- import { SketchEventProps, SketchFeature, SketchType } from "./types";
10
+ import { SketchComponentType, SketchEventProps, SketchFeature, SketchType } from "./types";
14
11
 
15
12
  export * from "./types";
16
13
 
17
- export type SketchComponentType = ComponentType<SketchComponentProps>;
18
-
19
- type GeometryOptions = {
20
- type: SketchType;
21
- controlPoints: readonly Position3d[];
22
- };
23
-
24
- type SketchComponentProps = RequireExactlyOne<
25
- {
26
- geometry?: LineString | Polygon | MultiPolygon | null;
27
- geometryOptions?: GeometryOptions | null;
28
- extrudedHeight?: number;
29
- disableShadow?: boolean;
30
- enableRelativeHeight?: boolean;
31
- color?: string;
32
- },
33
- "geometry" | "geometryOptions"
34
- >;
35
-
36
14
  export type OnLayerSelectType = (
37
15
  layerId: string | undefined,
38
16
  featureId: string | undefined,
@@ -27,3 +27,5 @@ export const PRESET_APPEARANCE: SketchAppearance = {
27
27
  strokeWidth: 2,
28
28
  },
29
29
  };
30
+
31
+ export const PRESET_COLOR: string = "#FFFFFF";
@@ -1,8 +1,29 @@
1
1
  import { Feature as GeojsonFeature, MultiPolygon, Polygon, Point, LineString } from "geojson";
2
+ import { ComponentType } from "react";
3
+ import { RequireExactlyOne } from "type-fest";
2
4
 
3
5
  import { LayerAppearanceTypes } from "../../mantle";
4
6
  import { Position3d } from "../../types";
5
7
 
8
+ type GeometryOptions = {
9
+ type: SketchType;
10
+ controlPoints: readonly Position3d[];
11
+ };
12
+
13
+ type SketchComponentProps = RequireExactlyOne<
14
+ {
15
+ geometry?: LineString | Polygon | MultiPolygon | null;
16
+ geometryOptions?: GeometryOptions | null;
17
+ extrudedHeight?: number;
18
+ disableShadow?: boolean;
19
+ enableRelativeHeight?: boolean;
20
+ color?: string;
21
+ },
22
+ "geometry" | "geometryOptions"
23
+ >;
24
+
25
+ export type SketchComponentType = ComponentType<SketchComponentProps>;
26
+
6
27
  export type SketchType =
7
28
  | "marker"
8
29
  | "polyline"
@@ -13,6 +34,16 @@ export type SketchType =
13
34
  | "extrudedRectangle"
14
35
  | "extrudedPolygon";
15
36
 
37
+ export type SketchOptions = {
38
+ color?: string;
39
+ appearance?: SketchAppearance;
40
+ dataOnly?: boolean;
41
+ disableShadow?: boolean;
42
+ enableRelativeHeight?: boolean;
43
+ rightClickToAbort?: boolean;
44
+ autoResetInteractionMode?: boolean;
45
+ };
46
+
16
47
  export type GeometryOptionsXYZ = {
17
48
  type: SketchType;
18
49
  controlPoints: Position3d[];
package/src/Map/hooks.ts CHANGED
@@ -9,7 +9,6 @@ import type {
9
9
  LayerSelectionReason,
10
10
  ComputedLayer,
11
11
  RequestingRenderMode,
12
- SceneProperty,
13
12
  SketchRef,
14
13
  } from "./types";
15
14
  import useTimelineManager, { TimelineManagerRef } from "./useTimelineManager";
@@ -24,13 +23,11 @@ export const REQUEST_RENDER_ONCE = 1;
24
23
 
25
24
  export default function ({
26
25
  ref,
27
- sceneProperty,
28
26
  timelineManagerRef,
29
27
  cursor,
30
28
  onLayerSelect,
31
29
  }: {
32
30
  ref: Ref<MapRef>;
33
- sceneProperty?: SceneProperty;
34
31
  timelineManagerRef?: TimelineManagerRef;
35
32
  cursor?: CursorType;
36
33
  onLayerSelect?: (
@@ -104,7 +101,6 @@ export default function ({
104
101
  );
105
102
 
106
103
  useTimelineManager({
107
- init: sceneProperty?.timeline,
108
104
  engineRef,
109
105
  timelineManagerRef,
110
106
  });
package/src/Map/index.tsx CHANGED
@@ -8,7 +8,7 @@ import Sketch, { SketchProps } from "./Sketch";
8
8
  import type { Engine, EngineProps } from "./types";
9
9
 
10
10
  export * from "./types";
11
- export { useGet, type WrappedRef, type Undefinable, useOverriddenProperty } from "./utils";
11
+ export { useGet, type WrappedRef, type Undefinable } from "./utils";
12
12
 
13
13
  export type {
14
14
  NaiveLayer,
@@ -36,7 +36,12 @@ export type Props = {
36
36
  engine?: string;
37
37
  } & Omit<
38
38
  LayersProps,
39
- "Feature" | "clusterComponent" | "selectionReason" | "delegatedDataTypes" | "selectedLayerId"
39
+ | "Feature"
40
+ | "clusterComponent"
41
+ | "selectionReason"
42
+ | "delegatedDataTypes"
43
+ | "selectedLayerId"
44
+ | "viewerProperty"
40
45
  > &
41
46
  Omit<EngineProps, "onLayerSelect" | "layerSelectionReason" | "selectedLayerId"> &
42
47
  Omit<SketchProps, "layersRef" | "engineRef" | "SketchComponent"> & {
@@ -54,7 +59,6 @@ function MapFn(
54
59
  layers,
55
60
  overrides,
56
61
  timelineManagerRef,
57
- sceneProperty,
58
62
  interactionMode,
59
63
  selectedFeature,
60
64
  cursor,
@@ -80,7 +84,6 @@ function MapFn(
80
84
  handleEngineLayerSelect,
81
85
  } = useHooks({
82
86
  ref,
83
- sceneProperty,
84
87
  timelineManagerRef,
85
88
  cursor,
86
89
  onLayerSelect,
@@ -123,7 +126,7 @@ function MapFn(
123
126
  clusterComponent={currentEngine?.clusterComponent}
124
127
  delegatedDataTypes={currentEngine.delegatedDataTypes}
125
128
  meta={props.meta}
126
- sceneProperty={props.property}
129
+ viewerProperty={props.property}
127
130
  requestingRenderMode={requestingRenderMode}
128
131
  onLayerSelect={handleLayerSelect}
129
132
  />
package/src/Map/ref.ts CHANGED
@@ -103,6 +103,7 @@ const layersRefKeys: FunctionKeys<LayersRef> = {
103
103
  findByTags: 1,
104
104
  hide: 1,
105
105
  isLayer: 1,
106
+ isComputedLayer: 1,
106
107
  layers: 1,
107
108
  override: 1,
108
109
  replace: 1,
@@ -117,14 +118,10 @@ const layersRefKeys: FunctionKeys<LayersRef> = {
117
118
  };
118
119
 
119
120
  const sketchRefKeys: FunctionKeys<SketchRef> = {
121
+ getType: 1,
120
122
  setType: 1,
121
- setColor: 1,
122
- setDefaultAppearance: 1,
123
- createDataOnly: 1,
124
- disableShadow: 1,
125
- enableRelativeHeight: 1,
126
- allowRightClickToAbort: 1,
127
- allowAutoResetInteractionMode: 1,
123
+ getOptions: 1,
124
+ overrideOptions: 1,
128
125
  };
129
126
 
130
127
  export function mapRef({