@itwin/core-backend 5.3.0-dev.1 → 5.3.0-dev.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 (429) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js.map +1 -1
  5. package/lib/cjs/BlobContainerService.js.map +1 -1
  6. package/lib/cjs/BriefcaseManager.d.ts +2 -2
  7. package/lib/cjs/BriefcaseManager.js.map +1 -1
  8. package/lib/cjs/CatalogDb.js.map +1 -1
  9. package/lib/cjs/Category.js.map +1 -1
  10. package/lib/cjs/ChangeSummaryManager.js +2 -2
  11. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  12. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  13. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  14. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  15. package/lib/cjs/ChannelControl.js.map +1 -1
  16. package/lib/cjs/CheckpointManager.js.map +1 -1
  17. package/lib/cjs/ClassRegistry.js +5 -5
  18. package/lib/cjs/ClassRegistry.js.map +1 -1
  19. package/lib/cjs/CloudSqlite.d.ts +10 -9
  20. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  21. package/lib/cjs/CloudSqlite.js.map +1 -1
  22. package/lib/cjs/CodeService.js.map +1 -1
  23. package/lib/cjs/CodeSpecs.js.map +1 -1
  24. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  25. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  26. package/lib/cjs/DevTools.js.map +1 -1
  27. package/lib/cjs/DisplayStyle.js.map +1 -1
  28. package/lib/cjs/ECDb.js.map +1 -1
  29. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  30. package/lib/cjs/ECSqlStatement.js.map +1 -1
  31. package/lib/cjs/Element.js.map +1 -1
  32. package/lib/cjs/ElementAspect.js.map +1 -1
  33. package/lib/cjs/ElementGraphics.js.map +1 -1
  34. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  35. package/lib/cjs/Entity.js.map +1 -1
  36. package/lib/cjs/EntityReferences.js.map +1 -1
  37. package/lib/cjs/ExportGraphics.js.map +1 -1
  38. package/lib/cjs/ExternalSource.js.map +1 -1
  39. package/lib/cjs/FontFile.js.map +1 -1
  40. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  41. package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
  42. package/lib/cjs/GeographicCRSServices.js +2 -0
  43. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  44. package/lib/cjs/GeometrySummary.js +47 -47
  45. package/lib/cjs/GeometrySummary.js.map +1 -1
  46. package/lib/cjs/IModelDb.js +9 -9
  47. package/lib/cjs/IModelDb.js.map +1 -1
  48. package/lib/cjs/IModelDbFonts.js.map +1 -1
  49. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  50. package/lib/cjs/IModelHost.d.ts +1 -2
  51. package/lib/cjs/IModelHost.d.ts.map +1 -1
  52. package/lib/cjs/IModelHost.js +9 -17
  53. package/lib/cjs/IModelHost.js.map +1 -1
  54. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  55. package/lib/cjs/IModelJsFs.js.map +1 -1
  56. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  57. package/lib/cjs/IpcHost.js.map +1 -1
  58. package/lib/cjs/LineStyle.js.map +1 -1
  59. package/lib/cjs/LocalHub.js +1 -1
  60. package/lib/cjs/LocalHub.js.map +1 -1
  61. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  62. package/lib/cjs/LockControl.js.map +1 -1
  63. package/lib/cjs/Material.js.map +1 -1
  64. package/lib/cjs/Model.js.map +1 -1
  65. package/lib/cjs/NativeAppStorage.js.map +1 -1
  66. package/lib/cjs/NativeHost.js.map +1 -1
  67. package/lib/cjs/NavigationRelationship.js.map +1 -1
  68. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  69. package/lib/cjs/PropertyStore.js.map +1 -1
  70. package/lib/cjs/Relationship.js.map +1 -1
  71. package/lib/cjs/RpcBackend.js.map +1 -1
  72. package/lib/cjs/SQLiteDb.js.map +1 -1
  73. package/lib/cjs/Schema.js.map +1 -1
  74. package/lib/cjs/SchemaSync.js.map +1 -1
  75. package/lib/cjs/SchemaUtils.js.map +1 -1
  76. package/lib/cjs/SheetIndex.js.map +1 -1
  77. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  78. package/lib/cjs/SqliteStatement.js.map +1 -1
  79. package/lib/cjs/StashManager.js.map +1 -1
  80. package/lib/cjs/Texture.js.map +1 -1
  81. package/lib/cjs/TileStorage.d.ts +1 -1
  82. package/lib/cjs/TileStorage.d.ts.map +1 -1
  83. package/lib/cjs/TileStorage.js.map +1 -1
  84. package/lib/cjs/TxnManager.js.map +1 -1
  85. package/lib/cjs/ViewDefinition.js.map +1 -1
  86. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  87. package/lib/cjs/ViewStore.js.map +1 -1
  88. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  89. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  90. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +25 -0
  91. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  92. package/lib/cjs/annotations/FrameGeometry.js +6 -6
  93. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  94. package/lib/cjs/annotations/LeaderGeometry.js +4 -4
  95. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  96. package/lib/cjs/annotations/TextAnnotationElement.d.ts +121 -21
  97. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  98. package/lib/cjs/annotations/TextAnnotationElement.js +283 -63
  99. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  100. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  101. package/lib/cjs/annotations/TextBlockGeometry.js +3 -3
  102. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  103. package/lib/cjs/annotations/TextBlockLayout.d.ts +2 -2
  104. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  105. package/lib/cjs/annotations/TextBlockLayout.js +52 -25
  106. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  107. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  108. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  109. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  110. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  111. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  112. package/lib/cjs/core-backend.js.map +1 -1
  113. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  114. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  115. package/lib/cjs/domains/GenericElements.js.map +1 -1
  116. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  117. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  118. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  119. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  120. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  121. package/lib/cjs/internal/HubMock.js.map +1 -1
  122. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  123. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  124. package/lib/cjs/internal/NoLocks.js.map +1 -1
  125. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  126. package/lib/cjs/internal/Symbols.js.map +1 -1
  127. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  128. package/lib/cjs/internal/annotations/fields.js +1 -0
  129. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  130. package/lib/cjs/internal/cross-package.js.map +1 -1
  131. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  132. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  133. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  134. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  135. package/lib/cjs/rpc/multipart.js.map +1 -1
  136. package/lib/cjs/rpc/tracing.js.map +1 -1
  137. package/lib/cjs/rpc/web/logging.js.map +1 -1
  138. package/lib/cjs/rpc/web/request.js.map +1 -1
  139. package/lib/cjs/rpc/web/response.js.map +1 -1
  140. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  141. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  142. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  143. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  144. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  145. package/lib/cjs/workspace/Settings.js.map +1 -1
  146. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  147. package/lib/cjs/workspace/Workspace.js.map +1 -1
  148. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  149. package/lib/esm/BackendHubAccess.js.map +1 -1
  150. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  151. package/lib/esm/BisCoreSchema.js.map +1 -1
  152. package/lib/esm/BlobContainerService.js.map +1 -1
  153. package/lib/esm/BriefcaseManager.d.ts +2 -2
  154. package/lib/esm/BriefcaseManager.js.map +1 -1
  155. package/lib/esm/CatalogDb.js.map +1 -1
  156. package/lib/esm/Category.js.map +1 -1
  157. package/lib/esm/ChangeSummaryManager.js +2 -2
  158. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  159. package/lib/esm/ChangedElementsDb.js.map +1 -1
  160. package/lib/esm/ChangesetECAdaptor.js +248 -248
  161. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  162. package/lib/esm/ChannelControl.js.map +1 -1
  163. package/lib/esm/CheckpointManager.js.map +1 -1
  164. package/lib/esm/ClassRegistry.js +5 -5
  165. package/lib/esm/ClassRegistry.js.map +1 -1
  166. package/lib/esm/CloudSqlite.d.ts +10 -9
  167. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  168. package/lib/esm/CloudSqlite.js.map +1 -1
  169. package/lib/esm/CodeService.js.map +1 -1
  170. package/lib/esm/CodeSpecs.js.map +1 -1
  171. package/lib/esm/ConcurrentQuery.js.map +1 -1
  172. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  173. package/lib/esm/DevTools.js.map +1 -1
  174. package/lib/esm/DisplayStyle.js.map +1 -1
  175. package/lib/esm/ECDb.js.map +1 -1
  176. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  177. package/lib/esm/ECSqlStatement.js.map +1 -1
  178. package/lib/esm/Element.js.map +1 -1
  179. package/lib/esm/ElementAspect.js.map +1 -1
  180. package/lib/esm/ElementGraphics.js.map +1 -1
  181. package/lib/esm/ElementTreeWalker.js.map +1 -1
  182. package/lib/esm/Entity.js.map +1 -1
  183. package/lib/esm/EntityReferences.js.map +1 -1
  184. package/lib/esm/ExportGraphics.js.map +1 -1
  185. package/lib/esm/ExternalSource.js.map +1 -1
  186. package/lib/esm/FontFile.js.map +1 -1
  187. package/lib/esm/GeoCoordConfig.js.map +1 -1
  188. package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
  189. package/lib/esm/GeographicCRSServices.js +2 -0
  190. package/lib/esm/GeographicCRSServices.js.map +1 -1
  191. package/lib/esm/GeometrySummary.js +47 -47
  192. package/lib/esm/GeometrySummary.js.map +1 -1
  193. package/lib/esm/IModelDb.js +9 -9
  194. package/lib/esm/IModelDb.js.map +1 -1
  195. package/lib/esm/IModelDbFonts.js.map +1 -1
  196. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  197. package/lib/esm/IModelHost.d.ts +1 -2
  198. package/lib/esm/IModelHost.d.ts.map +1 -1
  199. package/lib/esm/IModelHost.js +10 -18
  200. package/lib/esm/IModelHost.js.map +1 -1
  201. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  202. package/lib/esm/IModelJsFs.js.map +1 -1
  203. package/lib/esm/ImageSourceConversion.js.map +1 -1
  204. package/lib/esm/IpcHost.js.map +1 -1
  205. package/lib/esm/LineStyle.js.map +1 -1
  206. package/lib/esm/LocalHub.js +1 -1
  207. package/lib/esm/LocalHub.js.map +1 -1
  208. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  209. package/lib/esm/LockControl.js.map +1 -1
  210. package/lib/esm/Material.js.map +1 -1
  211. package/lib/esm/Model.js.map +1 -1
  212. package/lib/esm/NativeAppStorage.js.map +1 -1
  213. package/lib/esm/NativeHost.js.map +1 -1
  214. package/lib/esm/NavigationRelationship.js.map +1 -1
  215. package/lib/esm/PromiseMemoizer.js.map +1 -1
  216. package/lib/esm/PropertyStore.js.map +1 -1
  217. package/lib/esm/Relationship.js.map +1 -1
  218. package/lib/esm/RpcBackend.js.map +1 -1
  219. package/lib/esm/SQLiteDb.js.map +1 -1
  220. package/lib/esm/Schema.js.map +1 -1
  221. package/lib/esm/SchemaSync.js.map +1 -1
  222. package/lib/esm/SchemaUtils.js.map +1 -1
  223. package/lib/esm/SheetIndex.js.map +1 -1
  224. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  225. package/lib/esm/SqliteStatement.js.map +1 -1
  226. package/lib/esm/StashManager.js.map +1 -1
  227. package/lib/esm/Texture.js.map +1 -1
  228. package/lib/esm/TileStorage.d.ts +1 -1
  229. package/lib/esm/TileStorage.d.ts.map +1 -1
  230. package/lib/esm/TileStorage.js.map +1 -1
  231. package/lib/esm/TxnManager.js.map +1 -1
  232. package/lib/esm/ViewDefinition.js.map +1 -1
  233. package/lib/esm/ViewStateHydrator.js.map +1 -1
  234. package/lib/esm/ViewStore.js.map +1 -1
  235. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  236. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  237. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +25 -0
  238. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  239. package/lib/esm/annotations/FrameGeometry.js +6 -6
  240. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  241. package/lib/esm/annotations/LeaderGeometry.js +4 -4
  242. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  243. package/lib/esm/annotations/TextAnnotationElement.d.ts +121 -21
  244. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  245. package/lib/esm/annotations/TextAnnotationElement.js +283 -64
  246. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  247. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  248. package/lib/esm/annotations/TextBlockGeometry.js +3 -3
  249. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  250. package/lib/esm/annotations/TextBlockLayout.d.ts +2 -2
  251. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  252. package/lib/esm/annotations/TextBlockLayout.js +52 -25
  253. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  254. package/lib/esm/core-backend.js.map +1 -1
  255. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  256. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  257. package/lib/esm/domains/GenericElements.js.map +1 -1
  258. package/lib/esm/domains/GenericSchema.js.map +1 -1
  259. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  260. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  261. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  262. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  263. package/lib/esm/internal/HubMock.js.map +1 -1
  264. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  265. package/lib/esm/internal/NativePlatform.js.map +1 -1
  266. package/lib/esm/internal/NoLocks.js.map +1 -1
  267. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  268. package/lib/esm/internal/Symbols.js.map +1 -1
  269. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  270. package/lib/esm/internal/annotations/fields.js +1 -0
  271. package/lib/esm/internal/annotations/fields.js.map +1 -1
  272. package/lib/esm/internal/cross-package.js.map +1 -1
  273. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  274. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  275. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  276. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  277. package/lib/esm/rpc/multipart.js.map +1 -1
  278. package/lib/esm/rpc/tracing.js.map +1 -1
  279. package/lib/esm/rpc/web/logging.js.map +1 -1
  280. package/lib/esm/rpc/web/request.js.map +1 -1
  281. package/lib/esm/rpc/web/response.js.map +1 -1
  282. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  283. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  284. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  285. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  286. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  287. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  288. package/lib/esm/test/AnnotationTestUtils.js +1 -1
  289. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  290. package/lib/esm/test/AttachDb.test.js +11 -11
  291. package/lib/esm/test/AttachDb.test.js.map +1 -1
  292. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  293. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  294. package/lib/esm/test/IModelHost.test.js +17 -11
  295. package/lib/esm/test/IModelHost.test.js.map +1 -1
  296. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  297. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  298. package/lib/esm/test/IpcHost.test.js.map +1 -1
  299. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  300. package/lib/esm/test/PrintElementTree.js.map +1 -1
  301. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  302. package/lib/esm/test/RevisionUtility.js.map +1 -1
  303. package/lib/esm/test/SchemaUtils.test.js +25 -25
  304. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  305. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  306. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  307. package/lib/esm/test/TestUtils.js.map +1 -1
  308. package/lib/esm/test/annotations/Fields.test.js +185 -90
  309. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  310. package/lib/esm/test/annotations/FrameGeometry.test.js +4 -4
  311. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  312. package/lib/esm/test/annotations/LeaderGeometry.test.js +8 -8
  313. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  314. package/lib/esm/test/annotations/TextAnnotation.test.js +356 -36
  315. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  316. package/lib/esm/test/annotations/TextBlock.test.js +218 -151
  317. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  318. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  319. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  320. package/lib/esm/test/categories/Category.test.js.map +1 -1
  321. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  322. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  323. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  324. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +15 -15
  325. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  326. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  327. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  328. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  329. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  330. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  331. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  332. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  333. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  334. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  335. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  336. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  337. package/lib/esm/test/ecdb/ECSqlStatement.test.js +326 -326
  338. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  339. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  340. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  341. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  342. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  343. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  344. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  345. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  346. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  347. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  348. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  349. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  350. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  351. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  352. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  353. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  354. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  355. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  356. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  357. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  358. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  359. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  360. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  361. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  362. package/lib/esm/test/hubaccess/Rebase.test.js +33 -33
  363. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  364. package/lib/esm/test/imageData.js.map +1 -1
  365. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  366. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  367. package/lib/esm/test/imodel/IModel.test.js +62 -44
  368. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  369. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  370. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  371. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  372. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  373. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -1
  374. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
  375. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  376. package/lib/esm/test/index.js.map +1 -1
  377. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  378. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  379. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  380. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  381. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  382. package/lib/esm/test/rpc/response.test.js.map +1 -1
  383. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  384. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  385. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  386. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  387. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  388. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  389. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  390. package/lib/esm/test/standalone/ChangesetReader.test.js +124 -124
  391. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  392. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  393. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  394. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  395. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  396. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  397. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  398. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  399. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  400. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  401. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  402. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  403. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  404. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  405. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  406. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  407. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  408. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  409. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  410. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  411. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  412. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  413. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  414. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  415. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  416. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  417. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  418. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  419. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  420. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  421. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  422. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  423. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  424. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  425. package/lib/esm/workspace/Settings.js.map +1 -1
  426. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  427. package/lib/esm/workspace/Workspace.js.map +1 -1
  428. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  429. package/package.json +17 -19
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiX;AAEjX,wCAAoI;AACpI,sDAAyD;AACzD,uDAAuE;AACvE,qEAAwE;AACxE,+EAAkI;AAElI,SAAS,uBAAuB,CAAC,IAAwB;IACvD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,+BAA+B,CAAC,MAAgB,EAAE,OAAmB,EAAE,eAA+B,EAAE,0BAAkC,EAAE,UAAsB,EAAE,WAAwB,EAAE,YAAyB;IAC9N,MAAM,eAAe,GAAG,uBAAuB,CAAC,0BAA0B,CAAC,CAAC;IAC5E,MAAM,S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C,YAAY;YAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,+BAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC9C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,IAAwB;QAC5D,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AA1GD,kDA0GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { AnnotationTextStyleProps, BisCodeSpec, Code, CodeProps, CodeScopeProps, CodeSpec, ElementGeometry, ElementGeometryBuilderParams, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\nimport { AnnotationElement2d, DefinitionElement, Drawing, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from \"../Element\";\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport { layoutTextBlock, TextStyleResolver } from \"./TextBlockLayout\";\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\nimport { ElementDrivesTextAnnotation, TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from \"./ElementDrivesTextAnnotation\";\n\nfunction parseTextAnnotationData(json: string | undefined): TextAnnotationProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n}\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, _placementProps: PlacementProps, stringifiedAnnotationProps: string, categoryId: Id64String, textStyleId?: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const annotationProps = parseTextAnnotationData(stringifiedAnnotationProps);\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\n const textStyleResolver = new TextStyleResolver({textBlock, textStyleId: textStyleId ?? \"\", iModel});\n const layout = layoutTextBlock({ iModel, textBlock, textStyleResolver });\n const builder = new ElementGeometry.Builder();\n let scaleFactor = 1;\n const element = iModel.elements.getElement(modelId);\n if (element instanceof Drawing)\n scaleFactor = element.scaleFactor;\n appendTextAnnotationGeometry({ layout, textStyleResolver, scaleFactor, annotationProps: annotationProps ?? {}, builder, categoryId });\n\n return { entryArray: builder.entries };\n}\n\n/** Arguments supplied when creating a [[TextAnnotation2d]].\n * @beta\n */\nexport interface TextAnnotation2dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement2dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided. */\n textAnnotationData?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** Arguments supplied when creating a [[TextAnnotation3d]].\n * @beta\n */\nexport interface TextAnnotation3dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement3dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided. */\n textAnnotationData?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** An element that displays textual content within a 2d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation2d extends AnnotationElement2d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation2d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation2d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\n }\n\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationData = props.textAnnotationData;\n }\n\n /** Creates a new instance of `TextAnnotation2d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\n return new TextAnnotation2d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation2d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON() as TextAnnotation2dProps;\n props.textAnnotationData = this._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation2d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation2d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation2dCreateArgs): TextAnnotation2d {\n const elementProps: TextAnnotation2dProps = {\n classFullName: this.classFullName,\n textAnnotationData: JSON.stringify(arg.textAnnotationData),\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation2dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement2d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n}\n\n/** An element that displays textual content within a 3d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation3d extends GraphicalElement3d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation3d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation3d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\n }\n\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationData = props.textAnnotationData;\n }\n\n /** Creates a new instance of `TextAnnotation3d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\n return new TextAnnotation3d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation3d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation3dProps {\n const props = super.toJSON() as TextAnnotation3dProps;\n props.textAnnotationData = this._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation3d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation3d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation3dCreateArgs): TextAnnotation3d {\n const elementProps: TextAnnotation3dProps = {\n classFullName: this.classFullName,\n textAnnotationData: JSON.stringify(arg.textAnnotationData),\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation3dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement3d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n}\n\nfunction getTextBlocks(elem: TextAnnotation2d | TextAnnotation3d): Iterable<TextBlockAndId> {\n const annotation = elem.getAnnotation();\n return annotation ? [{ textBlock: annotation.textBlock, id: undefined }] : [];\n}\n\nfunction updateTextBlocks(elem: TextAnnotation2d | TextAnnotation3d, textBlocks: TextBlockAndId[]): void {\n assert(textBlocks.length === 1);\n assert(textBlocks[0].id === undefined);\n\n const annotation = elem.getAnnotation();\n if (!annotation) {\n // We must obtain the TextBlockAndId from the element in the first place, so the only way we could end up here is if\n // somebody removed the text annotation after we called getTextBlocks. That's gotta be a mistake.\n throw new Error(\"Text annotation element has no text\");\n }\n\n annotation.textBlock = textBlocks[0].textBlock;\n\n elem.setAnnotation(annotation);\n elem.update();\n}\n\n/**\n * The definition element that holds text style information.\n * The style is stored as a [TextStyleSettings]($common).\n * @beta\n */\nexport class AnnotationTextStyle extends DefinitionElement {\n /** @internal */\n public static override get className(): string { return \"AnnotationTextStyle\"; }\n /**\n * Optional text describing the `AnnotationTextStyle`.\n */\n public description?: string;\n /**\n * The text style settings for the `AnnotationTextStyle`.\n * @see [[TextStyleSettings]] for more information.\n */\n public settings: TextStyleSettings;\n\n protected constructor(props: AnnotationTextStyleProps, iModel: IModelDb) {\n super(props, iModel);\n this.description = props.description;\n const settingsProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n this.settings = TextStyleSettings.fromJSON(settingsProps);\n }\n\n /**\n * Creates a Code for an `AnnotationTextStyle` given a name that is meant to be unique within the scope of the specified DefinitionModel.\n *\n * @param iModel - The IModelDb.\n * @param definitionModelId - The ID of the DefinitionModel that contains the AnnotationTextStyle and provides the scope for its name.\n * @param name - The AnnotationTextStyle name.\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.annotationTextStyle);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n\n /**\n * Creates a new instance of `AnnotationTextStyle` with the specified properties.\n *\n * @param iModelDb - The iModelDb.\n * @param definitionModelId - The ID of the [[DefinitionModel]].\n * @param name - The name to assign to the `AnnotationTextStyle`.\n * @param settings - Optional text style settings used to create the `AnnotationTextStyle`. Default settings will be used if not provided.\n * @param description - Optional description for the `AnnotationTextStyle`.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, settings?: TextStyleSettingsProps, description?: string) {\n const props: AnnotationTextStyleProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name).toJSON(),\n description,\n settings: JSON.stringify(settings),\n }\n return new this(props, iModelDb);\n }\n\n /**\n * Converts the current `AnnotationTextStyle` instance to its JSON representation.\n * @inheritdoc\n */\n public override toJSON(): AnnotationTextStyleProps {\n const props = super.toJSON() as AnnotationTextStyleProps;\n props.description = this.description;\n props.settings = JSON.stringify(this.settings.toJSON());\n return props;\n }\n\n /** Creates a new instance of `AnnotationTextStyle` from its JSON representation. */\n public static fromJSON(props: AnnotationTextStyleProps, iModel: IModelDb): AnnotationTextStyle {\n return new AnnotationTextStyle(props, iModel);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n private static validateSettings(props: AnnotationTextStyleProps): void {\n const settingProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n if (!settingProps) return;\n const settings = TextStyleSettings.fromJSON(settingProps);\n const errors = settings.getValidationErrors();\n if (errors.length > 0) {\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\n }\n }\n\n private static parseTextStyleSettings(json: string | undefined): TextStyleSettingsProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n }\n}\n\n\n"]}
1
+ {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8DH,0DAIC;AAhED,oDAAic;AAEjc,wCAAoI;AACpI,sDAA+D;AAC/D,uDAAuE;AACvE,qEAAwE;AACxE,+EAAkI;AAGlI,iCAAiC;AAEjC;;;EAGE;AACW,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAEpD,SAAS,+BAA+B,CACtC,IAAY,EACZ,cAA+B,EAC/B,OAAqC;IAErC,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAqB,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC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,CAAC;QAC5B,OAAO,+BAA+B,CAAyB,IAAI,EAAE,wCAAgC,EAAE,wBAAwB,CAAC,CAAC;IACnI,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,iBAA6B,EAAE,OAAkC;QAC9F,8FAA8F;QAC9F,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAClE,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QAED,wDAAwD;QACxD,IAAI,UAAU,GAA2B,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;QACxF,IAAI,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,+CAA+C;QAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAsB,iBAAiB,CAAC,CAAC;QACjG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,mBAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED,gFAAgF;QAChF,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,0DAA0D;QAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrD,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACpE,OAAO,CAAC,YAAY,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACpD,OAAO,UAAU,CAAC;IACpB,CAAC;;AA/KH,kDAgLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Elements\r\n */\r\n\r\nimport { AnnotationTextStyleProps, BisCodeSpec, Code, CodeProps, CodeScopeProps, CodeSpec, ECVersionString, ElementGeometry, ElementGeometryBuilderParams, EntityReferenceSet, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps, traverseTextBlockComponent, VersionedJSON } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { AnnotationElement2d, DefinitionElement, Drawing, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from \"../Element\";\r\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { layoutTextBlock, TextStyleResolver } from \"./TextBlockLayout\";\r\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\r\nimport { ElementDrivesTextAnnotation, TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from \"./ElementDrivesTextAnnotation\";\r\nimport { IModelElementCloneContext } from \"../IModelElementCloneContext\";\r\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"../Entity\";\r\nimport * as semver from \"semver\";\r\n\r\n/** The version of the JSON stored in `TextAnnotation2d/3dProps.textAnnotationData` used by the code.\r\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\r\n * @internal\r\n*/\r\nexport const TEXT_ANNOTATION_JSON_VERSION = \"1.0.0\";\r\n\r\nfunction validateAndMigrateVersionedJSON<T>(\r\n json: string,\r\n currentVersion: ECVersionString,\r\n migrate: (old: VersionedJSON<T>) => T\r\n): VersionedJSON<T> | undefined {\r\n let parsed;\r\n try {\r\n parsed = JSON.parse(json) as VersionedJSON<T>;\r\n } catch {\r\n return undefined;\r\n }\r\n\r\n const version = parsed.version;\r\n if (typeof version !== \"string\" || !semver.valid(version))\r\n throw new Error(\"JSON version is missing or invalid.\");\r\n\r\n if (typeof parsed.data !== \"object\" || parsed.data === null)\r\n throw new Error(\"JSON data is missing or invalid.\");\r\n\r\n // Newer\r\n if (semver.gt(version, currentVersion))\r\n throw new Error(`JSON version ${parsed.version} is newer than supported version ${currentVersion}. Application update required to understand data.`);\r\n\r\n // Older\r\n if (semver.lt(version, currentVersion)) {\r\n parsed.data = migrate(parsed);\r\n parsed.version = currentVersion;\r\n }\r\n\r\n return parsed;\r\n}\r\n\r\nfunction migrateTextAnnotationData(oldData: VersionedJSON<TextAnnotationProps>): TextAnnotationProps {\r\n if (oldData.version === TEXT_ANNOTATION_JSON_VERSION) return oldData.data;\r\n\r\n // Place migration logic here.\r\n\r\n throw new Error(`Migration for textAnnotationData from version ${oldData.version} to ${TEXT_ANNOTATION_JSON_VERSION} failed.`);\r\n}\r\n\r\n/** Parses, validates, and potentially migrates the text annotation data from a JSON string.\r\n * @internal\r\n */\r\nexport function parseTextAnnotationData(json: string | undefined): VersionedJSON<TextAnnotationProps> | undefined {\r\n if (!json) return undefined;\r\n\r\n return validateAndMigrateVersionedJSON<TextAnnotationProps>(json, TEXT_ANNOTATION_JSON_VERSION, migrateTextAnnotationData);\r\n}\r\n\r\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, _placementProps: PlacementProps, annotationProps?: TextAnnotationProps, textStyleId?: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\r\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\r\n const textStyleResolver = new TextStyleResolver({textBlock, textStyleId: textStyleId ?? \"\", iModel});\r\n const layout = layoutTextBlock({ iModel, textBlock, textStyleResolver });\r\n const builder = new ElementGeometry.Builder();\r\n let scaleFactor = 1;\r\n const element = iModel.elements.getElement(modelId);\r\n if (element instanceof Drawing)\r\n scaleFactor = element.scaleFactor;\r\n appendTextAnnotationGeometry({ layout, textStyleResolver, scaleFactor, annotationProps: annotationProps ?? {}, builder, categoryId });\r\n\r\n return { entryArray: builder.entries };\r\n}\r\n\r\n/** Arguments supplied when creating a [[TextAnnotation2d]].\r\n * @beta\r\n */\r\nexport interface TextAnnotation2dCreateArgs {\r\n /** The category ID for the annotation. */\r\n category: Id64String;\r\n /** The model ID where the annotation will be placed. */\r\n model: Id64String;\r\n /** The placement properties for the annotation. */\r\n placement: Placement2dProps;\r\n /** The default text style ID for the annotation. */\r\n defaultTextStyleId?: Id64String;\r\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided. */\r\n textAnnotationProps?: TextAnnotationProps;\r\n /** Optional code for the element. */\r\n code?: CodeProps;\r\n}\r\n\r\n/** Arguments supplied when creating a [[TextAnnotation3d]].\r\n * @beta\r\n */\r\nexport interface TextAnnotation3dCreateArgs {\r\n /** The category ID for the annotation. */\r\n category: Id64String;\r\n /** The model ID where the annotation will be placed. */\r\n model: Id64String;\r\n /** The placement properties for the annotation. */\r\n placement: Placement3dProps;\r\n /** The default text style ID for the annotation. */\r\n defaultTextStyleId?: Id64String;\r\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided. */\r\n textAnnotationProps?: TextAnnotationProps;\r\n /** Optional code for the element. */\r\n code?: CodeProps;\r\n}\r\n\r\n/** An element that displays textual content within a 2d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation2d extends AnnotationElement2d /* implements ITextAnnotation */ {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation2d\"; }\r\n /**\r\n * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.\r\n * @beta\r\n */\r\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\r\n /** The data associated with the text annotation. */\r\n private _textAnnotationProps?: TextAnnotationProps;\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\r\n }\r\n\r\n /** Change the textual content of the `TextAnnotation2d`.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this._textAnnotationProps = annotation.toJSON();\r\n }\r\n\r\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.defaultTextStyle) {\r\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\r\n }\r\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\r\n }\r\n\r\n /** Creates a new instance of `TextAnnotation2d` from its JSON representation. */\r\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\r\n return new TextAnnotation2d(props, iModel);\r\n }\r\n\r\n /**\r\n * Converts the current `TextAnnotation2d` instance to its JSON representation.\r\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\r\n * @inheritdoc\r\n */\r\n public override toJSON(): TextAnnotation2dProps {\r\n const props = super.toJSON() as TextAnnotation2dProps;\r\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\r\n if (this._textAnnotationProps) {\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\r\n }\r\n\r\n return props;\r\n }\r\n\r\n /** Creates a new `TextAnnotation2d` instance with the specified properties.\r\n * @param iModelDb The iModel.\r\n * @param arg The arguments for creating the TextAnnotation2d.\r\n * @beta\r\n */\r\n public static create(iModelDb: IModelDb, arg: TextAnnotation2dCreateArgs): TextAnnotation2d {\r\n const elementProps: TextAnnotation2dProps = {\r\n classFullName: this.classFullName,\r\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\r\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\r\n placement: arg.placement,\r\n model: arg.model,\r\n category: arg.category,\r\n code: arg.code ?? Code.createEmpty(),\r\n };\r\n return new this(elementProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Updates the geometry of the TextAnnotation2d on insert and validates version.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onInsert(arg: OnElementPropsArg): void {\r\n super.onInsert(arg);\r\n this.validateVersionAndUpdateGeometry(arg);\r\n }\r\n\r\n /**\r\n * Updates the geometry of the TextAnnotation2d on update and validates version.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onUpdate(arg: OnElementPropsArg): void {\r\n super.onUpdate(arg);\r\n this.validateVersionAndUpdateGeometry(arg);\r\n }\r\n\r\n /**\r\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\r\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\r\n * Also, validates the version of the text annotation data and migrates it if necessary.\r\n * @beta\r\n */\r\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\r\n const props = arg.props as TextAnnotation2dProps;\r\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\r\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement2d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\r\n }\r\n }\r\n\r\n /**\r\n * TextAnnotation2d custom HandledProps include 'textAnnotationData'.\r\n * @inheritdoc\r\n * @internal\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"textAnnotationData\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * TextAnnotation2d deserializes 'textAnnotationData'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation2dProps {\r\n const elProps = super.deserialize(props) as TextAnnotation2dProps;\r\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\r\n if (textAnnotationData) {\r\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * TextAnnotation2d serializes 'textAnnotationData'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: TextAnnotation2dProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.textAnnotationData !== undefined) {\r\n inst.textAnnotationData = props.textAnnotationData;\r\n }\r\n return inst;\r\n }\r\n\r\n /** @internal */\r\n public getTextBlocks(): Iterable<TextBlockAndId> {\r\n return getTextBlocks(this);\r\n }\r\n\r\n /** @internal */\r\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\r\n return updateTextBlocks(this, textBlocks);\r\n }\r\n\r\n /** @internal */\r\n public static override onInserted(arg: OnElementIdArg): void {\r\n super.onInserted(arg);\r\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\r\n }\r\n\r\n /** @internal */\r\n public static override onUpdated(arg: OnElementIdArg): void {\r\n super.onUpdated(arg);\r\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n collectReferenceIds(this, referenceIds);\r\n }\r\n\r\n /** @internal */\r\n protected static override onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation2dProps, dstProps: TextAnnotation2dProps): void {\r\n super.onCloned(context, srcProps, dstProps);\r\n\r\n const srcElem = TextAnnotation2d.fromJSON(srcProps, context.sourceDb);\r\n ElementDrivesTextAnnotation.remapFields(srcElem, context);\r\n const anno = srcElem.getAnnotation();\r\ndstProps.textAnnotationData = anno ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;\r\n\r\n remapTextStyle(context, srcElem, dstProps);\r\n }\r\n}\r\n\r\n/** An element that displays textual content within a 3d model.\r\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\r\n * @see [[setAnnotation]] to change the textual content.\r\n * @public @preview\r\n */\r\nexport class TextAnnotation3d extends GraphicalElement3d /* implements ITextAnnotation */ {\r\n /** @internal */\r\n public static override get className(): string { return \"TextAnnotation3d\"; }\r\n /**\r\n * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.\r\n * @beta\r\n */\r\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\r\n /** The data associated with the text annotation. */\r\n private _textAnnotationProps?: TextAnnotationProps;\r\n\r\n /** Extract the textual content, if present.\r\n * @see [[setAnnotation]] to change it.\r\n */\r\n public getAnnotation(): TextAnnotation | undefined {\r\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\r\n }\r\n\r\n /** Change the textual content of the `TextAnnotation3d`.\r\n * @see [[getAnnotation]] to extract the current annotation.\r\n * @param annotation The new annotation\r\n */\r\n public setAnnotation(annotation: TextAnnotation) {\r\n this._textAnnotationProps = annotation.toJSON();\r\n }\r\n\r\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.defaultTextStyle) {\r\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\r\n }\r\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\r\n }\r\n\r\n /** Creates a new instance of `TextAnnotation3d` from its JSON representation. */\r\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\r\n return new TextAnnotation3d(props, iModel);\r\n }\r\n\r\n /**\r\n * Converts the current `TextAnnotation3d` instance to its JSON representation.\r\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\r\n * @inheritdoc\r\n */\r\n public override toJSON(): TextAnnotation3dProps {\r\n const props = super.toJSON() as TextAnnotation3dProps;\r\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\r\n if (this._textAnnotationProps) {\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\r\n }\r\n\r\n return props;\r\n }\r\n\r\n /** Creates a new `TextAnnotation3d` instance with the specified properties.\r\n * @param iModelDb The iModel.\r\n * @param arg The arguments for creating the TextAnnotation3d.\r\n * @beta\r\n */\r\n public static create(iModelDb: IModelDb, arg: TextAnnotation3dCreateArgs): TextAnnotation3d {\r\n const elementProps: TextAnnotation3dProps = {\r\n classFullName: this.classFullName,\r\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\r\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\r\n placement: arg.placement,\r\n model: arg.model,\r\n category: arg.category,\r\n code: arg.code ?? Code.createEmpty(),\r\n };\r\n return new this(elementProps, iModelDb);\r\n }\r\n\r\n /**\r\n * Updates the geometry of the TextAnnotation3d on insert and validates version..\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onInsert(arg: OnElementPropsArg): void {\r\n super.onInsert(arg);\r\n this.validateVersionAndUpdateGeometry(arg);\r\n }\r\n\r\n /**\r\n * Updates the geometry of the TextAnnotation3d on update and validates version..\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onUpdate(arg: OnElementPropsArg): void {\r\n super.onUpdate(arg);\r\n this.validateVersionAndUpdateGeometry(arg);\r\n }\r\n\r\n /**\r\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\r\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\r\n * Also, validates the version of the text annotation data and migrates it if necessary.\r\n * @beta\r\n */\r\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\r\n const props = arg.props as TextAnnotation3dProps;\r\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\r\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\r\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement3d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\r\n }\r\n }\r\n\r\n /**\r\n * TextAnnotation3d custom HandledProps include 'textAnnotationData'.\r\n * @inheritdoc\r\n * @internal\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"textAnnotationData\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * TextAnnotation3d deserializes 'textAnnotationData'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation3dProps {\r\n const elProps = super.deserialize(props) as TextAnnotation3dProps;\r\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\r\n if (textAnnotationData) {\r\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * TextAnnotation3d serializes 'textAnnotationData'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: TextAnnotation3dProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.textAnnotationData !== undefined) {\r\n inst.textAnnotationData = props.textAnnotationData;\r\n }\r\n return inst;\r\n }\r\n\r\n /** @internal */\r\n public getTextBlocks(): Iterable<TextBlockAndId> {\r\n return getTextBlocks(this);\r\n }\r\n\r\n /** @internal */\r\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\r\n return updateTextBlocks(this, textBlocks);\r\n }\r\n\r\n /** @internal */\r\n public static override onInserted(arg: OnElementIdArg): void {\r\n super.onInserted(arg);\r\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\r\n }\r\n\r\n /** @internal */\r\n public static override onUpdated(arg: OnElementIdArg): void {\r\n super.onUpdated(arg);\r\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n collectReferenceIds(this, referenceIds);\r\n }\r\n\r\n /** @internal */\r\n protected static override onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation3dProps, dstProps: TextAnnotation3dProps): void {\r\n super.onCloned(context, srcProps, dstProps);\r\n\r\n const srcElem = TextAnnotation3d.fromJSON(srcProps, context.sourceDb);\r\n ElementDrivesTextAnnotation.remapFields(srcElem, context);\r\n const anno = srcElem.getAnnotation();\r\n dstProps.textAnnotationData = anno ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;\r\n\r\n remapTextStyle(context, srcElem, dstProps);\r\n }\r\n}\r\n\r\nfunction remapTextStyle(\r\n context: IModelElementCloneContext,\r\n srcElem: TextAnnotation2d | TextAnnotation3d,\r\n dstProps: TextAnnotation2dProps | TextAnnotation3dProps\r\n): void {\r\n const dstStyleId = AnnotationTextStyle.remapTextStyleId(srcElem.defaultTextStyle?.id ?? Id64.invalid, context);\r\n dstProps.defaultTextStyle = Id64.isValid(dstStyleId) ? new TextAnnotationUsesTextStyleByDefault(dstStyleId).toJSON() : undefined;\r\n}\r\n\r\nfunction collectReferenceIds(elem: TextAnnotation2d | TextAnnotation3d, referenceIds: EntityReferenceSet): void {\r\n const style = elem.defaultTextStyle?.id;\r\n if (style && Id64.isValidId64(style)) {\r\n referenceIds.addElement(style);\r\n }\r\n\r\n const block = elem.getAnnotation()?.textBlock;\r\n if (block) {\r\n for (const { child } of traverseTextBlockComponent(block)) {\r\n if (child.type === \"field\") {\r\n const hostId = child.propertyHost.elementId;\r\n if (Id64.isValidId64(hostId)) {\r\n referenceIds.addElement(hostId);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction getTextBlocks(elem: TextAnnotation2d | TextAnnotation3d): Iterable<TextBlockAndId> {\r\n const annotation = elem.getAnnotation();\r\n return annotation ? [{ textBlock: annotation.textBlock, id: undefined }] : [];\r\n}\r\n\r\nfunction updateTextBlocks(elem: TextAnnotation2d | TextAnnotation3d, textBlocks: TextBlockAndId[]): void {\r\n assert(textBlocks.length === 1);\r\n assert(textBlocks[0].id === undefined);\r\n\r\n const annotation = elem.getAnnotation();\r\n if (!annotation) {\r\n // We must obtain the TextBlockAndId from the element in the first place, so the only way we could end up here is if\r\n // somebody removed the text annotation after we called getTextBlocks. That's gotta be a mistake.\r\n throw new Error(\"Text annotation element has no text\");\r\n }\r\n\r\n annotation.textBlock = textBlocks[0].textBlock;\r\n\r\n elem.setAnnotation(annotation);\r\n}\r\n\r\n/** The version of the JSON stored in `AnnotationTextStyleProps.settings` used by the code.\r\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\r\n * @internal\r\n*/\r\nexport const TEXT_STYLE_SETTINGS_JSON_VERSION = \"1.0.0\";\r\n\r\nfunction migrateTextStyleSettings(oldData: VersionedJSON<TextStyleSettingsProps>): TextStyleSettingsProps {\r\n if (oldData.version === TEXT_STYLE_SETTINGS_JSON_VERSION) return oldData.data;\r\n\r\n // Place migration logic here.\r\n\r\n throw new Error(`Migration for settings from version ${oldData.version} to ${TEXT_STYLE_SETTINGS_JSON_VERSION} failed.`);\r\n}\r\n\r\n/** Arguments supplied when creating an [[AnnotationTextStyle]].\r\n * @beta\r\n */\r\nexport interface TextStyleCreateArgs {\r\n /** The ID of the [[DefinitionModel]]. */\r\n definitionModelId: Id64String;\r\n /** The name to assign to the [[AnnotationTextStyle]]. */\r\n name: string;\r\n /** Optional text style settings used to create the [[AnnotationTextStyle]]. Default settings will be used if not provided. */\r\n settings?: TextStyleSettingsProps;\r\n /** Optional description for the [[AnnotationTextStyle]]. */\r\n description?: string;\r\n}\r\n\r\n/**\r\n * The definition element that holds text style information.\r\n * The style is stored as a [TextStyleSettings]($common).\r\n * @beta\r\n */\r\nexport class AnnotationTextStyle extends DefinitionElement {\r\n /** @internal */\r\n public static override get className(): string { return \"AnnotationTextStyle\"; }\r\n /**\r\n * Optional text describing the `AnnotationTextStyle`.\r\n */\r\n public description?: string;\r\n /**\r\n * The text style settings for the `AnnotationTextStyle`.\r\n * @see [[TextStyleSettings]] for more information.\r\n */\r\n public settings: TextStyleSettings;\r\n\r\n protected constructor(props: AnnotationTextStyleProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.description = props.description;\r\n const settingsProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\r\n this.settings = TextStyleSettings.fromJSON(settingsProps?.data);\r\n }\r\n\r\n /**\r\n * Creates a Code for an `AnnotationTextStyle` given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n *\r\n * @param iModel - The IModelDb.\r\n * @param definitionModelId - The ID of the DefinitionModel that contains the AnnotationTextStyle and provides the scope for its name.\r\n * @param name - The AnnotationTextStyle name.\r\n * @beta\r\n */\r\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.annotationTextStyle);\r\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\r\n }\r\n\r\n /**\r\n * Creates a new instance of `AnnotationTextStyle` with the specified properties.\r\n *\r\n * @param iModelDb - The iModelDb.\r\n * @param arg - The arguments for creating the AnnotationTextStyle.\r\n * @beta\r\n */\r\n public static create(iModelDb: IModelDb, arg: TextStyleCreateArgs): AnnotationTextStyle {\r\n const props: AnnotationTextStyleProps = {\r\n classFullName: this.classFullName,\r\n model: arg.definitionModelId,\r\n code: this.createCode(iModelDb, arg.definitionModelId, arg.name).toJSON(),\r\n description: arg.description,\r\n settings: arg.settings ? JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: arg.settings}) : undefined,\r\n }\r\n return new this(props, iModelDb);\r\n }\r\n\r\n /**\r\n * Converts the current `AnnotationTextStyle` instance to its JSON representation.\r\n * @inheritdoc\r\n */\r\n public override toJSON(): AnnotationTextStyleProps {\r\n const props = super.toJSON() as AnnotationTextStyleProps;\r\n props.description = this.description;\r\n props.settings = JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: this.settings.toJSON()});\r\n return props;\r\n }\r\n\r\n /** Creates a new instance of `AnnotationTextStyle` from its JSON representation. */\r\n public static fromJSON(props: AnnotationTextStyleProps, iModel: IModelDb): AnnotationTextStyle {\r\n return new AnnotationTextStyle(props, iModel);\r\n }\r\n\r\n /**\r\n * Validates that the AnnotationTextStyle's settings are valid before insert.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onInsert(arg: OnElementPropsArg): void {\r\n super.onInsert(arg);\r\n this.validateSettings(arg.props as AnnotationTextStyleProps);\r\n }\r\n\r\n /**\r\n * Validates that the AnnotationTextStyle's settings are valid before update.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override onUpdate(arg: OnElementPropsArg): void {\r\n super.onUpdate(arg);\r\n this.validateSettings(arg.props as AnnotationTextStyleProps);\r\n }\r\n\r\n private static validateSettings(props: AnnotationTextStyleProps): void {\r\n const settingProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\r\n if (!settingProps) return;\r\n const settings = TextStyleSettings.fromJSON(settingProps.data);\r\n const errors = settings.getValidationErrors();\r\n if (errors.length > 0) {\r\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\r\n }\r\n }\r\n\r\n /**\r\n * AnnotationTextStyle custom HandledProps include 'settings'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\r\n { propertyName: \"settings\", source: \"Class\" },\r\n ];\r\n\r\n /**\r\n * AnnotationTextStyle deserializes 'settings'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override deserialize(props: DeserializeEntityArgs): AnnotationTextStyleProps {\r\n const elProps = super.deserialize(props) as AnnotationTextStyleProps;\r\n const settings = this.parseTextStyleSettings(props.row.settings);\r\n if (settings) {\r\n elProps.settings = JSON.stringify(settings);\r\n }\r\n return elProps;\r\n }\r\n\r\n /**\r\n * AnnotationTextStyle serializes 'settings'.\r\n * @inheritdoc\r\n * @beta\r\n */\r\n public static override serialize(props: AnnotationTextStyleProps, iModel: IModelDb): ECSqlRow {\r\n const inst = super.serialize(props, iModel);\r\n if (props.settings !== undefined) {\r\n inst.settings = props.settings;\r\n }\r\n return inst;\r\n }\r\n\r\n /** Parses, validates, and potentially migrates the text style settings data from a JSON string. */\r\n private static parseTextStyleSettings(json: string | undefined): VersionedJSON<TextStyleSettingsProps> | undefined {\r\n if (!json) return undefined;\r\n return validateAndMigrateVersionedJSON<TextStyleSettingsProps>(json, TEXT_STYLE_SETTINGS_JSON_VERSION, migrateTextStyleSettings);\r\n }\r\n\r\n /** When copying an element from one iModel to another, returns the Id of the AnnotationTextStyle in the `context`'s target iModel\r\n * corresponding to `sourceTextStyleId`, or [Id64.invalid]($bentley) if no corresponding text style exists.\r\n * If a text style with the same [Code]($common) exists in the target iModel, the style Id will be remapped to refer to that style.\r\n * Otherwise, a copy of the style will be imported into the target iModel and its element Id returned.\r\n * Implementations of [[ITextAnnotation]] should invoke this function when implementing their [[Element._onCloned]] method.\r\n * @throws Error if an attempt to import the text style failed.\r\n */\r\n public static remapTextStyleId(sourceTextStyleId: Id64String, context: IModelElementCloneContext): Id64String {\r\n // No remapping necessary if there's no text style or we're not copying to a different iModel.\r\n if (!Id64.isValid(sourceTextStyleId) || !context.isBetweenIModels) {\r\n return sourceTextStyleId;\r\n }\r\n\r\n // If the style's already been remapped, we're finished.\r\n let dstStyleId: Id64String | undefined = context.findTargetElementId(sourceTextStyleId);\r\n if (Id64.isValid(dstStyleId)) {\r\n return dstStyleId;\r\n }\r\n\r\n // Look up the style. It really ought to exist.\r\n const srcStyle = context.sourceDb.elements.tryGetElement<AnnotationTextStyle>(sourceTextStyleId);\r\n if (!srcStyle) {\r\n return Id64.invalid;\r\n }\r\n\r\n // If a style with the same code exists in the target iModel, remap to that one.\r\n dstStyleId = context.targetDb.elements.queryElementIdByCode(srcStyle.code);\r\n if (undefined !== dstStyleId) {\r\n return dstStyleId;\r\n }\r\n\r\n // Copy the style into the target iModel and remap its Id.\r\n const dstStyleProps = context.cloneElement(srcStyle);\r\n dstStyleId = context.targetDb.elements.insertElement(dstStyleProps);\r\n context.remapElement(sourceTextStyleId, dstStyleId);\r\n return dstStyleId;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAsCH,oEA8BC;AAlED,oDAAoJ;AAEpJ,wDAAuF;AACvF,sDAAuD;AACvD,2DAA+D;AAC/D,mDAA8E;AAC9E,qDAA0D;AA0B1D;;;GAGG;AACH,SAAgB,4BAA4B,CAAC,KAAuC;IAClF,MAAM,UAAU,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAElE,MAAM,SAAS,GAAG,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAErF,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,kCAAkC;IAClC,MAAM,MAAM,GAAG,IAAI,4BAAc,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAA,4CAAwB,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AE,SAAS,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextStyleSettings } from \"@itwin/core-common\";\nimport { RunLayout, TextBlockLayout, TextStyleResolver } from \"./TextBlockLayout\";\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\nimport { appendLeadersToBuilder } from \"./LeaderGeometry\";\n\n/**\n * Properties required to compute the geometry of a text annotation.\n * @beta\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\n */\nexport interface AppendTextAnnotationGeometryArgs {\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\n annotationProps: TextAnnotationProps;\n /** Layout provided by calling [[layoutTextBlock]] */\n layout: TextBlockLayout;\n /** [[TextStyleResolver]] used to get styling and scale information for creating geometry. */\n textStyleResolver: TextStyleResolver;\n /** The scale factor to apply to the annotation. Usually comes from the `scaleFactor` of a [[Drawing]] element. */\n scaleFactor: number;\n /** Builder that will be added to in place */\n builder: ElementGeometry.Builder;\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\n categoryId: Id64String\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\n subCategoryId?: Id64String\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\n wantDebugGeometry?: boolean;\n}\n\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\n * @returns true if the geometry was successfully appended.\n * @beta\n */\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\n\n const transform = annotation.computeTransform(props.layout.range, props.scaleFactor);\n\n let result = true;\n\n // Construct the TextBlockGeometry\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\n const entries = produceTextBlockGeometry(props.layout, transform.clone());\n result = result && props.builder.appendTextBlock(entries, params);\n\n // Construct the frame geometry\n if (props.textStyleResolver.blockSettings.frame.shape !== \"none\") {\n result = result && appendFrameToBuilder(props.builder, props.textStyleResolver.blockSettings.frame, props.layout.range, transform.clone(), params);\n }\n\n // Construct the leader geometry\n if (annotation.leaders && annotation.leaders.length > 0) {\n result = result && appendLeadersToBuilder(props.builder, annotation.leaders, props.layout, transform.clone(), params, props.textStyleResolver, props.scaleFactor);\n }\n\n // Construct the debug geometry\n if (props.wantDebugGeometry) {\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, transform.clone());\n result = result && debugRunLayout(props.builder, props.layout, transform.clone());\n if (props.textStyleResolver.blockSettings.frame.shape !== \"none\") result = result && debugSnapPoints(props.builder, props.textStyleResolver.blockSettings, props.layout.range, transform.clone());\n }\n\n return result;\n};\n\n/**\n * Draws the anchor point and margins of the text annotation.\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\n * The margins are drawn as a blue box.\n * The text range is drawn as a red box.\n */\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\n const range = Range2d.fromJSON(layout.range);\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\n\n // Make it blue\n const blueLineParams = new GeometryParams(Id64.invalid);\n blueLineParams.lineColor = ColorDef.blue;\n let result = builder.appendGeometryParamsChange(blueLineParams);\n\n // Draw a blue box to show the element's margin\n const marginCorners = range.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(marginCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\n\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\n\n // Draw a red box to show the text range\n const redLineParams = new GeometryParams(Id64.invalid);\n redLineParams.lineColor = ColorDef.red;\n result = result && builder.appendGeometryParamsChange(redLineParams);\n\n const rangeCorners = layout.textRange.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\n\n return result;\n}\n\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\nfunction debugSnapPoints(builder: ElementGeometry.Builder, style: TextStyleSettings, range: Range2d, transform: Transform): boolean {\n if (style.frame.shape === \"none\")\n return false;\n const points = computeIntervalPoints({ frame: style.frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\n\n const params = new GeometryParams(Id64.invalid);\n params.lineColor = ColorDef.black;\n params.weight = style.frame.borderWeight * 5; // We want the dots to be bigger than the frame so we can see them.\n params.fillDisplay = FillDisplay.Always;\n\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\n return result;\n}\n\n/**\n * Draws debug geometry for each line and run in a TextBlockLayout.\n *\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\n * This is useful for debugging text layout and alignment issues.\n *\n * @param builder - The geometry builder to append debug geometry to.\n * @param layout - The text block layout containing lines and runs to visualize.\n * @param documentTransform - The transform to apply to the entire document.\n * @returns True if all debug geometry was successfully appended.\n */\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\n let result = true; // Tracks if all geometry was appended successfully\n let lastColor = ColorDef.black; // Last color used, to minimize param changes\n\n // Map run types to debug colors\n const colors = {\n \"text\": ColorDef.fromString(\"orange\"),\n \"linebreak\": ColorDef.fromString(\"yellow\"),\n \"fraction\": ColorDef.fromString(\"green\"),\n \"tab\": ColorDef.fromString(\"aquamarine\"),\n \"field\": ColorDef.fromString(\"purple\"),\n \"marker\": ColorDef.fromString(\"pink\"),\n }\n\n const drawBox = (run: RunLayout, lineTransform: Transform, newColor: ColorDef) => {\n // Only change geometry params if the color changes\n if (lastColor !== newColor) {\n const colorParams = new GeometryParams(Id64.invalid);\n colorParams.lineColor = newColor;\n colorParams.weight = run.source.type === \"linebreak\" ? 3 : undefined;\n result = result && builder.appendGeometryParamsChange(colorParams);\n lastColor = newColor;\n }\n\n // Apply the line's offset to the run's offset\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTransform.multiplyTransformTransform(runTrans, runTrans);\n\n // Draw the enclosing range for the run\n const runCorners = run.range.corners3d(true);\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\n }\n\n layout.lines.forEach(line => {\n // Apply the line's offset transform\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\n\n if (line.marker) {\n drawBox(line.marker, lineTrans, colors.marker);\n }\n\n line.runs.forEach(run => {\n // Determine color for this run type\n const color = colors[run.source.type] ?? ColorDef.black;\n drawBox(run, lineTrans, color);\n });\n });\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAsCH,oEA8BC;AAlED,oDAAoJ;AAEpJ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IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1G,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAEnE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,oCAAoC;YACpC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAQ,CAAC,KAAK,CAAC;YACxD,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextStyleSettings } from \"@itwin/core-common\";\r\nimport { RunLayout, TextBlockLayout, TextStyleResolver } from \"./TextBlockLayout\";\r\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\r\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\r\nimport { appendLeadersToBuilder } from \"./LeaderGeometry\";\r\n\r\n/**\r\n * Properties required to compute the geometry of a text annotation.\r\n * @beta\r\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\r\n */\r\nexport interface AppendTextAnnotationGeometryArgs {\r\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\r\n annotationProps: TextAnnotationProps;\r\n /** Layout provided by calling [[layoutTextBlock]] */\r\n layout: TextBlockLayout;\r\n /** [[TextStyleResolver]] used to get styling and scale information for creating geometry. */\r\n textStyleResolver: TextStyleResolver;\r\n /** The scale factor to apply to the annotation. Usually comes from the `scaleFactor` of a [[Drawing]] element. */\r\n scaleFactor: number;\r\n /** Builder that will be added to in place */\r\n builder: ElementGeometry.Builder;\r\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\r\n categoryId: Id64String\r\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\r\n subCategoryId?: Id64String\r\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\r\n wantDebugGeometry?: boolean;\r\n}\r\n\r\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\r\n * @returns true if the geometry was successfully appended.\r\n * @beta\r\n */\r\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\r\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\r\n\r\n const transform = annotation.computeTransform(props.layout.range, props.scaleFactor);\r\n\r\n let result = true;\r\n\r\n // Construct the TextBlockGeometry\r\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\r\n const entries = produceTextBlockGeometry(props.layout, transform.clone());\r\n result = result && props.builder.appendTextBlock(entries, params);\r\n\r\n // Construct the frame geometry\r\n if (props.textStyleResolver.blockSettings.frame.shape !== \"none\") {\r\n result = result && appendFrameToBuilder(props.builder, props.textStyleResolver.blockSettings.frame, props.layout.range, transform.clone(), params);\r\n }\r\n\r\n // Construct the leader geometry\r\n if (annotation.leaders && annotation.leaders.length > 0) {\r\n result = result && appendLeadersToBuilder(props.builder, annotation.leaders, props.layout, transform.clone(), params, props.textStyleResolver, props.scaleFactor);\r\n }\r\n\r\n // Construct the debug geometry\r\n if (props.wantDebugGeometry) {\r\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, transform.clone());\r\n result = result && debugRunLayout(props.builder, props.layout, transform.clone());\r\n if (props.textStyleResolver.blockSettings.frame.shape !== \"none\") result = result && debugSnapPoints(props.builder, props.textStyleResolver.blockSettings, props.layout.range, transform.clone());\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/**\r\n * Draws the anchor point and margins of the text annotation.\r\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\r\n * The margins are drawn as a blue box.\r\n * The text range is drawn as a red box.\r\n */\r\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\r\n const range = Range2d.fromJSON(layout.range);\r\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\r\n\r\n // Make it blue\r\n const blueLineParams = new GeometryParams(Id64.invalid);\r\n blueLineParams.lineColor = ColorDef.blue;\r\n let result = builder.appendGeometryParamsChange(blueLineParams);\r\n\r\n // Draw a blue box to show the element's margin\r\n const marginCorners = range.corners3d(true);\r\n transform.multiplyPoint3dArrayInPlace(marginCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\r\n\r\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\r\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\r\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\r\n\r\n // Draw a red box to show the text range\r\n const redLineParams = new GeometryParams(Id64.invalid);\r\n redLineParams.lineColor = ColorDef.red;\r\n result = result && builder.appendGeometryParamsChange(redLineParams);\r\n\r\n const rangeCorners = layout.textRange.corners3d(true);\r\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\r\n\r\n return result;\r\n}\r\n\r\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\r\nfunction debugSnapPoints(builder: ElementGeometry.Builder, style: TextStyleSettings, range: Range2d, transform: Transform): boolean {\r\n if (style.frame.shape === \"none\")\r\n return false;\r\n const points = computeIntervalPoints({ frame: style.frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\r\n\r\n const params = new GeometryParams(Id64.invalid);\r\n params.lineColor = ColorDef.black;\r\n params.weight = style.frame.borderWeight * 5; // We want the dots to be bigger than the frame so we can see them.\r\n params.fillDisplay = FillDisplay.Always;\r\n\r\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\r\n return result;\r\n}\r\n\r\n/**\r\n * Draws debug geometry for each line and run in a TextBlockLayout.\r\n *\r\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\r\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\r\n * This is useful for debugging text layout and alignment issues.\r\n *\r\n * @param builder - The geometry builder to append debug geometry to.\r\n * @param layout - The text block layout containing lines and runs to visualize.\r\n * @param documentTransform - The transform to apply to the entire document.\r\n * @returns True if all debug geometry was successfully appended.\r\n */\r\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\r\n let result = true; // Tracks if all geometry was appended successfully\r\n let lastColor = ColorDef.black; // Last color used, to minimize param changes\r\n\r\n // Map run types to debug colors\r\n const colors = {\r\n \"text\": ColorDef.fromString(\"orange\"),\r\n \"linebreak\": ColorDef.fromString(\"yellow\"),\r\n \"fraction\": ColorDef.fromString(\"green\"),\r\n \"tab\": ColorDef.fromString(\"aquamarine\"),\r\n \"field\": ColorDef.fromString(\"purple\"),\r\n \"marker\": ColorDef.fromString(\"pink\"),\r\n }\r\n\r\n const drawBox = (run: RunLayout, lineTransform: Transform, newColor: ColorDef) => {\r\n // Only change geometry params if the color changes\r\n if (lastColor !== newColor) {\r\n const colorParams = new GeometryParams(Id64.invalid);\r\n colorParams.lineColor = newColor;\r\n colorParams.weight = run.source.type === \"linebreak\" ? 3 : undefined;\r\n result = result && builder.appendGeometryParamsChange(colorParams);\r\n lastColor = newColor;\r\n }\r\n\r\n // Apply the line's offset to the run's offset\r\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\r\n lineTransform.multiplyTransformTransform(runTrans, runTrans);\r\n\r\n // Draw the enclosing range for the run\r\n const runCorners = run.range.corners3d(true);\r\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\r\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\r\n }\r\n\r\n layout.lines.forEach(line => {\r\n // Apply the line's offset transform\r\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\r\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\r\n\r\n if (line.marker) {\r\n drawBox(line.marker, lineTrans, colors.marker);\r\n }\r\n\r\n line.runs.forEach(run => {\r\n // Determine color for this run type\r\n const color = colors[run.source.type] ?? ColorDef.black;\r\n drawBox(run, lineTrans, color);\r\n });\r\n });\r\n\r\n return result;\r\n}\r\n"]}
@@ -19,11 +19,11 @@ function setColor(color, context) {
19
19
  }
20
20
  function createTextString(text, run, origin) {
21
21
  (0, core_bentley_1.assert)(text.length > 0);
22
- const { lineHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;
22
+ const { textHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;
23
23
  return new core_common_1.TextString({
24
24
  text,
25
25
  font: run.fontId,
26
- height: lineHeight,
26
+ height: textHeight,
27
27
  widthFactor,
28
28
  bold: isBold,
29
29
  italic: isItalic,
@@ -74,7 +74,7 @@ function processFractionRun(run, transform, context) {
74
74
  return;
75
75
  }
76
76
  (0, core_bentley_1.assert)(undefined !== run.numeratorRange && undefined !== run.denominatorRange);
77
- const fontSize = new core_geometry_1.Vector2d(run.style.lineHeight * run.style.widthFactor, run.style.lineHeight);
77
+ const fontSize = new core_geometry_1.Vector2d(run.style.textHeight * run.style.widthFactor, run.style.textHeight);
78
78
  fontSize.scale(run.style.stackedFractionScale, fontSize);
79
79
  const numeratorOffset = new core_geometry_1.Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);
80
80
  const denominatorOffset = new core_geometry_1.Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);
@@ -1 +1 @@
1
- {"version":3,"file":"TextBlockGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA8IH,4DAmCC;AA/KD,oDAAqH;AAErH,wDAA4F;AAC5F,sDAA6C;AAO7C,SAAS,QAAQ,CAAC,KAAqB,EAAE,OAAwB;IAC/D,IAAI,KAAK,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;QACzB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,GAAc,EAAE,MAAgB;IACtE,IAAA,qBAAM,EAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;IAE9E,OAAO,IAAI,wBAAU,CAAC;QACpB,IAAI;QACJ,IAAI,EAAE,GAAG,CAAC,MAAM;QAChB,MAAM,EAAE,UAAU;QAClB,WAAW;QACX,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,YAAY;QACvB,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CA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Q,CAAC,CAAC;YACzD,iBAAiB,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;iBAAM,IAAI,UAAU,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC1C,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACN,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { TextBlockGeometryProps, TextBlockGeometryPropsEntry, TextString, TextStyleColor } from \"@itwin/core-common\";\nimport { RunLayout, TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\nimport { assert } from \"@itwin/core-bentley\";\n\ninterface GeometryContext {\n curColor?: TextStyleColor;\n entries: TextBlockGeometryPropsEntry[];\n}\n\nfunction setColor(color: TextStyleColor, context: GeometryContext): void {\n if (color !== context.curColor) {\n context.curColor = color;\n context.entries.push({ color });\n }\n}\n\nfunction createTextString(text: string, run: RunLayout, origin?: Point3d): TextString {\n assert(text.length > 0);\n\n const { lineHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;\n\n return new TextString({\n text,\n font: run.fontId,\n height: lineHeight,\n widthFactor,\n bold: isBold,\n italic: isItalic,\n underline: isUnderlined,\n origin,\n });\n}\n\nfunction processTextRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n assert(run.source.type === \"text\");\n const text = run.source.content.substring(run.charOffset, run.charOffset + run.numChars);\n if (text.length === 0) {\n return;\n }\n\n const ts = createTextString(text, run);\n if (\"none\" !== run.source.baselineShift) {\n const isSub = \"subscript\" === run.source.baselineShift;\n const offsetFactor = run.style[isSub ? \"subScriptOffsetFactor\" : \"superScriptOffsetFactor\"];\n const scale = run.style[isSub ? \"subScriptScale\" : \"superScriptScale\"];\n\n ts.origin.y += offsetFactor * ts.height;\n ts.height *= scale;\n }\n\n ts.transformInPlace(transform);\n\n setColor(run.style.color, context);\n context.entries.push({ text: ts });\n}\n\nfunction processFieldRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n assert(run.source.type === \"field\");\n const text = run.source.cachedContent.substring(run.charOffset, run.charOffset + run.numChars);\n if (text.length === 0) {\n return;\n }\n\n const ts = createTextString(text, run);\n ts.transformInPlace(transform);\n\n setColor(run.style.color, context);\n context.entries.push({ text: ts });\n}\n\nfunction createFractionTextString(text: string, run: RunLayout, origin: Point3d, transform: Transform): TextString {\n const ts = createTextString(text, run, origin);\n assert(undefined !== ts.widthFactor);\n\n ts.height *= run.style.stackedFractionScale;\n\n ts.transformInPlace(transform);\n\n return ts;\n}\n\nfunction processFractionRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\n const source = run.source;\n assert(source.type === \"fraction\");\n\n if (source.numerator.length === 0 && source.denominator.length === 0) {\n return;\n }\n\n assert(undefined !== run.numeratorRange && undefined !== run.denominatorRange);\n\n const fontSize = new Vector2d(run.style.lineHeight * run.style.widthFactor, run.style.lineHeight);\n fontSize.scale(run.style.stackedFractionScale, fontSize);\n\n const numeratorOffset = new Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);\n const denominatorOffset = new Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);\n\n setColor(run.style.color, context);\n\n if (source.numerator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.numerator, run, numeratorOffset, transform) });\n }\n\n const numeratorRange = Range2d.fromJSON(run.numeratorRange);\n const denominatorRange = Range2d.fromJSON(run.denominatorRange);\n\n let separator: LineSegment3d;\n if (run.style.stackedFractionType === \"horizontal\") {\n const fractionWidth = Math.max(numeratorRange.xLength(), denominatorRange.xLength());\n const y = 1.25 * denominatorRange.yLength();\n separator = LineSegment3d.createXYXY(0, y, fractionWidth, y);\n } else {\n const p0 = new Point3d(denominatorRange.low.x - fontSize.x / 2, denominatorRange.low.y + fontSize.y * (1 / 3), 0);\n const p1 = new Point3d(p0.x + fontSize.x, p0.y + fontSize.y * 1.5, 0);\n separator = LineSegment3d.createCapture(p0, p1);\n }\n\n separator.tryTransformInPlace(transform);\n\n context.entries.push({\n separator: {\n startPoint: separator.point0Ref.toJSON(),\n endPoint: separator.point1Ref.toJSON(),\n },\n });\n\n if (source.denominator.length > 0) {\n context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });\n }\n}\n\n/**\n * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].\n * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.\n * @param layout of the text block as computed by [[layoutTextBlock]].\n * @param documentTransform that positions the text block in world coordinates.\n * @returns TextBlockGeometryProps.\n * @beta\n */\nexport function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps {\n const context: GeometryContext = { entries: [] };\n for (const line of layout.lines) {\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n\n // Create geometry for list markers if present\n if (line.marker) {\n const markerTrans = Transform.createTranslationXYZ(line.marker.offsetFromLine.x, line.marker.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(markerTrans, markerTrans);\n documentTransform.multiplyTransformTransform(markerTrans, markerTrans);\n\n processTextRun(line.marker, markerTrans, context);\n }\n\n // Create geometry for runs\n for (const run of line.runs) {\n // Skip runs that are solely whitespace\n if (run.source.isWhitespace) {\n continue;\n }\n\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n documentTransform.multiplyTransformTransform(runTrans, runTrans);\n if (\"text\" === run.source.type) {\n processTextRun(run, runTrans, context);\n } else if (\"fraction\" === run.source.type) {\n processFractionRun(run, runTrans, context);\n } else {\n processFieldRun(run, runTrans, context);\n }\n }\n }\n\n return { entries: context.entries };\n}\n"]}
1
+ {"version":3,"file":"TextBlockGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextBlockGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA8IH,4DAmCC;AA/KD,oDAAqH;AAErH,wDAA4F;AAC5F,sDAA6C;AAO7C,SAAS,QAAQ,CAAC,KAAqB,EAAE,OAAwB;IAC/D,IAAI,KAAK,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;QACzB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,GAAc,EAAE,MAAgB;IACtE,IAAA,qBAAM,EAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;IAE9E,OAAO,IAAI,wBAAU,CAAC;QACpB,IAAI;QACJ,IAAI,EAAE,GAAG,CAAC,MAAM;QAChB,MAAM,EAAE,UAAU;QAClB,WAAW;QACX,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,YAAY;QACvB,MAAM;K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F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACzD,iBAAiB,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;iBAAM,IAAI,UAAU,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC1C,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACN,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementGeometry\r\n */\r\n\r\nimport { TextBlockGeometryProps, TextBlockGeometryPropsEntry, TextString, TextStyleColor } from \"@itwin/core-common\";\r\nimport { RunLayout, TextBlockLayout } from \"./TextBlockLayout\";\r\nimport { LineSegment3d, Point3d, Range2d, Transform, Vector2d } from \"@itwin/core-geometry\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\n\r\ninterface GeometryContext {\r\n curColor?: TextStyleColor;\r\n entries: TextBlockGeometryPropsEntry[];\r\n}\r\n\r\nfunction setColor(color: TextStyleColor, context: GeometryContext): void {\r\n if (color !== context.curColor) {\r\n context.curColor = color;\r\n context.entries.push({ color });\r\n }\r\n}\r\n\r\nfunction createTextString(text: string, run: RunLayout, origin?: Point3d): TextString {\r\n assert(text.length > 0);\r\n\r\n const { textHeight, widthFactor, isBold, isItalic, isUnderlined } = run.style;\r\n\r\n return new TextString({\r\n text,\r\n font: run.fontId,\r\n height: textHeight,\r\n widthFactor,\r\n bold: isBold,\r\n italic: isItalic,\r\n underline: isUnderlined,\r\n origin,\r\n });\r\n}\r\n\r\nfunction processTextRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\r\n assert(run.source.type === \"text\");\r\n const text = run.source.content.substring(run.charOffset, run.charOffset + run.numChars);\r\n if (text.length === 0) {\r\n return;\r\n }\r\n\r\n const ts = createTextString(text, run);\r\n if (\"none\" !== run.source.baselineShift) {\r\n const isSub = \"subscript\" === run.source.baselineShift;\r\n const offsetFactor = run.style[isSub ? \"subScriptOffsetFactor\" : \"superScriptOffsetFactor\"];\r\n const scale = run.style[isSub ? \"subScriptScale\" : \"superScriptScale\"];\r\n\r\n ts.origin.y += offsetFactor * ts.height;\r\n ts.height *= scale;\r\n }\r\n\r\n ts.transformInPlace(transform);\r\n\r\n setColor(run.style.color, context);\r\n context.entries.push({ text: ts });\r\n}\r\n\r\nfunction processFieldRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\r\n assert(run.source.type === \"field\");\r\n const text = run.source.cachedContent.substring(run.charOffset, run.charOffset + run.numChars);\r\n if (text.length === 0) {\r\n return;\r\n }\r\n\r\n const ts = createTextString(text, run);\r\n ts.transformInPlace(transform);\r\n\r\n setColor(run.style.color, context);\r\n context.entries.push({ text: ts });\r\n}\r\n\r\nfunction createFractionTextString(text: string, run: RunLayout, origin: Point3d, transform: Transform): TextString {\r\n const ts = createTextString(text, run, origin);\r\n assert(undefined !== ts.widthFactor);\r\n\r\n ts.height *= run.style.stackedFractionScale;\r\n\r\n ts.transformInPlace(transform);\r\n\r\n return ts;\r\n}\r\n\r\nfunction processFractionRun(run: RunLayout, transform: Transform, context: GeometryContext): void {\r\n const source = run.source;\r\n assert(source.type === \"fraction\");\r\n\r\n if (source.numerator.length === 0 && source.denominator.length === 0) {\r\n return;\r\n }\r\n\r\n assert(undefined !== run.numeratorRange && undefined !== run.denominatorRange);\r\n\r\n const fontSize = new Vector2d(run.style.textHeight * run.style.widthFactor, run.style.textHeight);\r\n fontSize.scale(run.style.stackedFractionScale, fontSize);\r\n\r\n const numeratorOffset = new Point3d(run.numeratorRange.low.x, run.numeratorRange.low.y, 0);\r\n const denominatorOffset = new Point3d(run.denominatorRange.low.x, run.denominatorRange.low.y, 0);\r\n\r\n setColor(run.style.color, context);\r\n\r\n if (source.numerator.length > 0) {\r\n context.entries.push({ text: createFractionTextString(source.numerator, run, numeratorOffset, transform) });\r\n }\r\n\r\n const numeratorRange = Range2d.fromJSON(run.numeratorRange);\r\n const denominatorRange = Range2d.fromJSON(run.denominatorRange);\r\n\r\n let separator: LineSegment3d;\r\n if (run.style.stackedFractionType === \"horizontal\") {\r\n const fractionWidth = Math.max(numeratorRange.xLength(), denominatorRange.xLength());\r\n const y = 1.25 * denominatorRange.yLength();\r\n separator = LineSegment3d.createXYXY(0, y, fractionWidth, y);\r\n } else {\r\n const p0 = new Point3d(denominatorRange.low.x - fontSize.x / 2, denominatorRange.low.y + fontSize.y * (1 / 3), 0);\r\n const p1 = new Point3d(p0.x + fontSize.x, p0.y + fontSize.y * 1.5, 0);\r\n separator = LineSegment3d.createCapture(p0, p1);\r\n }\r\n\r\n separator.tryTransformInPlace(transform);\r\n\r\n context.entries.push({\r\n separator: {\r\n startPoint: separator.point0Ref.toJSON(),\r\n endPoint: separator.point1Ref.toJSON(),\r\n },\r\n });\r\n\r\n if (source.denominator.length > 0) {\r\n context.entries.push({ text: createFractionTextString(source.denominator, run, denominatorOffset, transform) });\r\n }\r\n}\r\n\r\n/**\r\n * Produces the geometry for a text block in a way that can be interpreted by a [[GeometryStreamBuilder]] or [[ElementBuilder.Geometry]].\r\n * To build the geometry for a whole [[TextAnnotation]], use [[appendTextAnnotationGeometry]] instead.\r\n * @param layout of the text block as computed by [[layoutTextBlock]].\r\n * @param documentTransform that positions the text block in world coordinates.\r\n * @returns TextBlockGeometryProps.\r\n * @beta\r\n */\r\nexport function produceTextBlockGeometry(layout: TextBlockLayout, documentTransform: Transform): TextBlockGeometryProps {\r\n const context: GeometryContext = { entries: [] };\r\n for (const line of layout.lines) {\r\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\r\n\r\n // Create geometry for list markers if present\r\n if (line.marker) {\r\n const markerTrans = Transform.createTranslationXYZ(line.marker.offsetFromLine.x, line.marker.offsetFromLine.y, 0);\r\n lineTrans.multiplyTransformTransform(markerTrans, markerTrans);\r\n documentTransform.multiplyTransformTransform(markerTrans, markerTrans);\r\n\r\n processTextRun(line.marker, markerTrans, context);\r\n }\r\n\r\n // Create geometry for runs\r\n for (const run of line.runs) {\r\n // Skip runs that are solely whitespace\r\n if (run.source.isWhitespace) {\r\n continue;\r\n }\r\n\r\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\r\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\r\n documentTransform.multiplyTransformTransform(runTrans, runTrans);\r\n if (\"text\" === run.source.type) {\r\n processTextRun(run, runTrans, context);\r\n } else if (\"fraction\" === run.source.type) {\r\n processFractionRun(run, runTrans, context);\r\n } else {\r\n processFieldRun(run, runTrans, context);\r\n }\r\n }\r\n }\r\n\r\n return { entries: context.entries };\r\n}\r\n"]}
@@ -20,7 +20,7 @@ export interface ComputeRangesForTextLayoutArgs {
20
20
  baselineShift: BaselineShift;
21
21
  fontId: FontId;
22
22
  widthFactor: number;
23
- lineHeight: number;
23
+ textHeight: number;
24
24
  }
25
25
  /** A function that uses a font to compute the layout and justification ranges of a string of text.
26
26
  * @internal
@@ -130,7 +130,7 @@ declare class LayoutContext {
130
130
  private readonly _findFontId;
131
131
  private readonly _fontIds;
132
132
  constructor(textStyleResolver: TextStyleResolver, _computeTextRange: ComputeRangesForTextLayout, _findFontId: FindFontId);
133
- findFontId(name: string): FontId;
133
+ findFontId(name: string, type?: FontType): FontId;
134
134
  computeRangeForText(chars: string, style: TextStyleSettings, baselineShift: BaselineShift): TextLayoutRanges;
135
135
  computeRangeForTextRun(style: TextStyleSettings, run: TextRun | FieldRun, charOffset: number, numChars: number): TextLayoutRanges;
136
136
  computeRangeForFractionRun(style: TextStyleSettings, source: FractionRun): {
@@ -1 +1 @@
1
- {"version":3,"file":"TextBlockLayout.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextBlockLayout.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAiB,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAgC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,qBAAqB,EAAoB,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACtU,OAAO,EAAY,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAU,UAAU,EAA2B,MAAM,qBAAqB,CAAC;AAKlF,gBAAgB;AAChB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,8BAA8B,KAAK,gBAAgB,CAAC;AAEpG;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG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B;IACtB,KAAK,EAAE,UAAU,EAAE,CAAM;IAChC,OAAO,CAAC,QAAQ,CAAgB;gBAEb,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa;IAcrD,QAAQ,IAAI,qBAAqB;IAOxC,yEAAyE;IAClE,SAAS,IAAI,MAAM;IAI1B,OAAO,KAAK,KAAK,GAGhB;IAED,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,iBAAiB;IAkFzB,OAAO,CAAC,WAAW;IAwCnB,OAAO,CAAC,SAAS;IA2CjB,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,YAAY;CAoBrB"}
@@ -79,7 +79,7 @@ function scaleRange(range, scale) {
79
79
  range.high.scaleInPlace(scale);
80
80
  }
81
81
  /**
82
- * Applies block level settings (lineSpacingFactor, lineHeight, widthFactor, frame, and leader) to a [TextStyleSettings]($common).
82
+ * Applies block level settings (lineSpacingFactor, paragraphSpacingFactor, widthFactor, frame, margins, justification, and leader) to a [TextStyleSettings]($common).
83
83
  * These must be set on the block, as they are meaningless on individual paragraphs/runs.
84
84
  * However, leaders are a special case and can override the block's leader settings.
85
85
  * Setting `isLeader` to `true` makes the [TextBlock]($common) settings not override the leader's settings.
@@ -90,21 +90,27 @@ function applyBlockSettings(target, source, isLeader = false) {
90
90
  return target;
91
91
  }
92
92
  const lineSpacingFactor = source.lineSpacingFactor ?? target.lineSpacingFactor;
93
- const lineHeight = source.lineHeight ?? target.lineHeight;
93
+ const paragraphSpacingFactor = source.paragraphSpacingFactor ?? target.paragraphSpacingFactor;
94
94
  const widthFactor = source.widthFactor ?? target.widthFactor;
95
+ const justification = source.justification ?? target.justification;
95
96
  const frame = source.frame ?? target.frame;
97
+ const margins = source.margins ?? target.margins;
96
98
  const leader = source.leader ?? target.leader;
97
99
  const leaderShouldChange = !isLeader && !target.leaderEquals(leader);
98
100
  if (lineSpacingFactor !== target.lineSpacingFactor ||
99
- lineHeight !== target.lineHeight ||
101
+ paragraphSpacingFactor !== target.paragraphSpacingFactor ||
100
102
  widthFactor !== target.widthFactor ||
103
+ justification !== target.justification ||
101
104
  !target.frameEquals(frame) ||
105
+ !target.marginsEqual(margins) ||
102
106
  leaderShouldChange) {
103
107
  const cloneProps = {
104
108
  lineSpacingFactor,
105
- lineHeight,
109
+ paragraphSpacingFactor,
106
110
  widthFactor,
111
+ justification,
107
112
  frame,
113
+ margins,
108
114
  };
109
115
  if (leaderShouldChange) {
110
116
  cloneProps.leader = leader;
@@ -160,35 +166,35 @@ class LayoutContext {
160
166
  this._computeTextRange = _computeTextRange;
161
167
  this._findFontId = _findFontId;
162
168
  }
163
- findFontId(name) {
169
+ findFontId(name, type) {
164
170
  let fontId = this._fontIds.get(name);
165
171
  if (undefined === fontId) {
166
- this._fontIds.set(name, fontId = this._findFontId(name));
172
+ this._fontIds.set(name, fontId = this._findFontId(name, type));
167
173
  }
168
174
  return fontId;
169
175
  }
170
176
  computeRangeForText(chars, style, baselineShift) {
171
177
  if (chars.length === 0) {
172
178
  return {
173
- layout: new core_geometry_1.Range2d(0, 0, 0, style.lineHeight),
179
+ layout: new core_geometry_1.Range2d(0, 0, 0, style.textHeight),
174
180
  justification: new core_geometry_1.Range2d(),
175
181
  };
176
182
  }
177
- const fontId = this.findFontId(style.fontName);
183
+ const fontId = this.findFontId(style.font.name, style.font.type);
178
184
  const { layout, justification } = this._computeTextRange({
179
185
  chars,
180
186
  fontId,
181
187
  baselineShift,
182
188
  bold: style.isBold,
183
189
  italic: style.isItalic,
184
- lineHeight: this.textStyleResolver.blockSettings.lineHeight,
190
+ textHeight: style.textHeight,
185
191
  widthFactor: this.textStyleResolver.blockSettings.widthFactor,
186
192
  });
187
193
  if ("none" !== baselineShift) {
188
194
  const isSub = "subscript" === baselineShift;
189
195
  const scale = isSub ? style.subScriptScale : style.superScriptScale;
190
196
  const offsetFactor = isSub ? style.subScriptOffsetFactor : style.superScriptOffsetFactor;
191
- const offset = { x: 0, y: style.lineHeight * offsetFactor };
197
+ const offset = { x: 0, y: style.textHeight * offsetFactor };
192
198
  scaleRange(layout, scale);
193
199
  layout.cloneTranslated(offset, layout);
194
200
  scaleRange(justification, scale);
@@ -240,7 +246,7 @@ class LayoutContext {
240
246
  computeRangeForTabRun(style, source, lengthFromLastTab) {
241
247
  const interval = source.styleOverrides.tabInterval ?? style.tabInterval;
242
248
  const tabEndX = interval - lengthFromLastTab % interval;
243
- const range = new core_geometry_1.Range2d(0, 0, 0, style.lineHeight);
249
+ const range = new core_geometry_1.Range2d(0, 0, 0, style.textHeight);
244
250
  range.extendXY(tabEndX, range.low.y);
245
251
  return range;
246
252
  }
@@ -297,7 +303,7 @@ class RunLayout {
297
303
  }
298
304
  static create(source, context, cumulativeOverrides) {
299
305
  const style = context.textStyleResolver.resolveSettings(cumulativeOverrides);
300
- const fontId = context.findFontId(style.fontName);
306
+ const fontId = context.findFontId(style.font.name, style.font.type);
301
307
  const charOffset = 0;
302
308
  const offsetFromLine = { x: 0, y: 0 };
303
309
  let numChars = 0;
@@ -323,7 +329,7 @@ class RunLayout {
323
329
  default: { // "linebreak" or "tab"
324
330
  // "tab": Tabs rely on the context they are in, so we compute its range later.
325
331
  // lineBreak: We do this so that blank lines space correctly without special casing later.
326
- range = new core_geometry_1.Range2d(0, 0, 0, style.lineHeight);
332
+ range = new core_geometry_1.Range2d(0, 0, 0, style.textHeight);
327
333
  break;
328
334
  }
329
335
  }
@@ -437,15 +443,36 @@ class LineLayout {
437
443
  this.runRange.low.setZero();
438
444
  this.runRange.high.setZero();
439
445
  this.lengthFromLastTab = 0;
440
- // Some runs (fractions) are taller than others.
441
- // We want to center each run vertically inside the line.
442
446
  let lineHeight = 0;
447
+ let tallestNonFractionRun;
443
448
  for (const run of this._runs) {
444
- lineHeight = Math.max(lineHeight, run.range.yLength());
449
+ const runHeight = run.range.yLength();
450
+ lineHeight = Math.max(lineHeight, runHeight);
451
+ if (run.source.type !== "fraction" && (!tallestNonFractionRun || runHeight > tallestNonFractionRun.range.yLength())) {
452
+ tallestNonFractionRun = run;
453
+ }
454
+ }
455
+ // // The baseline for the line is the bottom of the tallest non-fraction run, centered in the line.
456
+ let baseline = 0;
457
+ if (tallestNonFractionRun) {
458
+ baseline = (lineHeight + tallestNonFractionRun.range.yLength()) / 2;
445
459
  }
446
460
  for (const run of this._runs) {
447
461
  const runHeight = run.range.yLength();
448
- const runOffset = { x: this.runRange.high.x, y: (lineHeight - runHeight) / 2 };
462
+ // Vertically align runs: normal text at baseline, fractions visually centered on text or line as appropriate.
463
+ let yOffset = lineHeight - baseline;
464
+ if (run.source.type === "fraction") {
465
+ const denominatorHeight = run.denominatorRange?.yLength() ?? 0;
466
+ if (tallestNonFractionRun && run.style.textHeight <= tallestNonFractionRun.style.textHeight) {
467
+ // Shift fraction to baseline, then down by half the denominator height so it appears centered relative to any non-fraction text of the same height.
468
+ yOffset = (lineHeight - baseline) - denominatorHeight / 2;
469
+ }
470
+ else {
471
+ // If the fraction text height is greater than the largest non-fraction text, just center it in the line.
472
+ yOffset = (lineHeight - runHeight) / 2;
473
+ }
474
+ }
475
+ const runOffset = { x: this.runRange.high.x, y: yOffset };
449
476
  run.offsetFromLine = runOffset;
450
477
  const runLayoutRange = run.range.cloneTranslated(runOffset);
451
478
  this.runRange.extendRange(runLayoutRange);
@@ -507,8 +534,8 @@ class TextBlockLayout {
507
534
  this.textRange.high.x = source.width;
508
535
  }
509
536
  this.populateLines(context);
510
- this.justifyLines();
511
- this.applyMargins(source.margins);
537
+ this.justifyLines(context);
538
+ this.applyMargins(context.textStyleResolver.blockSettings.margins);
512
539
  }
513
540
  toResult() {
514
541
  return {
@@ -647,7 +674,7 @@ class TextBlockLayout {
647
674
  }
648
675
  if (curLine.source.type !== "linebreak") {
649
676
  const newLine = new LineLayout(next, cumulativeOverrides, context, depth);
650
- newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;
677
+ newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
651
678
  return newLine;
652
679
  }
653
680
  const run = curLine.source.clone();
@@ -659,7 +686,7 @@ class TextBlockLayout {
659
686
  // Place it below any existing lines
660
687
  if (this.lines.length > 0) {
661
688
  lineOffset.y += this._back.offsetFromDocument.y;
662
- lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;
689
+ lineOffset.y -= context.textStyleResolver.blockSettings.lineSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
663
690
  }
664
691
  curLine.offsetFromDocument = lineOffset;
665
692
  // Update document range from computed line range and position
@@ -667,14 +694,14 @@ class TextBlockLayout {
667
694
  this.lines.push(curLine);
668
695
  if (newParagraph) {
669
696
  const newLine = new LineLayout(next, cumulativeOverrides, context, depth);
670
- newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.lineHeight;
697
+ newLine.offsetFromDocument.y -= context.textStyleResolver.blockSettings.paragraphSpacingFactor * context.textStyleResolver.blockSettings.textHeight;
671
698
  return newLine;
672
699
  }
673
700
  return new LineLayout(next, cumulativeOverrides, context, depth);
674
701
  }
675
- justifyLines() {
702
+ justifyLines(context) {
676
703
  // We don't want to justify empty text, or a single line of text whose width is 0. By default text is already left justified.
677
- if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || "left" === this.source.justification) {
704
+ if (this.lines.length < 1 || (this.lines.length === 1 && this.source.width === 0) || "left" === context.textStyleResolver.blockSettings.justification) {
678
705
  return;
679
706
  }
680
707
  // This is the minimum width of the document's bounding box.
@@ -683,7 +710,7 @@ class TextBlockLayout {
683
710
  for (const line of this.lines) {
684
711
  const lineWidth = line.justificationRange.xLength() + line.offsetFromDocument.x;
685
712
  let offset = docWidth - lineWidth;
686
- if ("center" === this.source.justification) {
713
+ if ("center" === context.textStyleResolver.blockSettings.justification) {
687
714
  offset = offset / 2;
688
715
  }
689
716
  line.offsetFromDocument.x += offset;