@dajiaoai/algeo-sdk 2.12.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -582,7 +582,7 @@ interface FileContent {
582
582
 
583
583
  所有模式均读取文件中的 `camera.scale`;文件未提供时默认为 `50`。`slideIndices` 使用从 `1` 开始的画板索引,省略时导出全部画板。
584
584
 
585
- 适合精确导出一个世界坐标视野时使用 `view`:
585
+ 适合精确指定导出视野时使用 `view`。2D 画板传 `viewBounds`:
586
586
 
587
587
  ```ts
588
588
  const images = await editor.slides.exportImage({
@@ -596,6 +596,27 @@ const images = await editor.slides.exportImage({
596
596
 
597
597
  `viewBounds` 的位置和宽高均为世界坐标,`scale` 为可选的相机缩放比例。省略 `scale` 时使用目标画板文件中的 `camera.scale`。
598
598
 
599
+ 3D 画板传同级的 `viewCamera3d`。其中 `width`、`height` 必填;`width`、`height` 为世界坐标视野范围。`offset`、`yaw`、`pitch`、`scale` 可选且省略时沿用文件相机;投影方式与斜投影参数始终沿用画板文件。
600
+
601
+ ```ts
602
+ const images = await editor.slides.exportImage({
603
+ mode: 'view',
604
+ slideIndices: [2],
605
+ format: 'png',
606
+ viewCamera3d: {
607
+ offset: [0, 0, 0],
608
+ yaw: Math.PI / 4,
609
+ pitch: Math.PI / 6,
610
+ scale: 0.2,
611
+ width: 12,
612
+ height: 8,
613
+ },
614
+ pixelRatio: 2,
615
+ });
616
+ ```
617
+
618
+ 一个 `view` 请求可以同时传 `viewBounds` 与 `viewCamera3d`,用于批量导出混合 2D/3D 画板;每张画板自动读取适用字段。2D 画板未提供 `viewBounds`、或 3D 画板未提供 `viewCamera3d` 时会报错。3D 仅支持 PNG、JPG;对 3D 画板请求 SVG 会报错。
619
+
599
620
  适合完整包住全部内容且不限定最终宽高时使用 `contain`:
600
621
 
601
622
  ```ts
@@ -4011,7 +4011,7 @@ function convertToLatest(content) {
4011
4011
  }
4012
4012
 
4013
4013
  /** SDK 版本号,构建时由 rollup 注入 */
4014
- const VERSION = '2.12.0';
4014
+ const VERSION = '2.12.1';
4015
4015
  const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
4016
4016
  const DEFAULT_PRESENTATION_PATH = '/embed/present';
4017
4017
  const DEFAULT_EDITOR_PATH = '/embed/edit';
@@ -4009,7 +4009,7 @@ function convertToLatest(content) {
4009
4009
  }
4010
4010
 
4011
4011
  /** SDK 版本号,构建时由 rollup 注入 */
4012
- const VERSION = '2.12.0';
4012
+ const VERSION = '2.12.1';
4013
4013
  const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
4014
4014
  const DEFAULT_PRESENTATION_PATH = '/embed/present';
4015
4015
  const DEFAULT_EDITOR_PATH = '/embed/edit';
@@ -4015,7 +4015,7 @@
4015
4015
  }
4016
4016
 
4017
4017
  /** SDK 版本号,构建时由 rollup 注入 */
4018
- const VERSION = '2.12.0';
4018
+ const VERSION = '2.12.1';
4019
4019
  const DEFAULT_EMBED_BASE = 'https://dajiaoai.com';
4020
4020
  const DEFAULT_PRESENTATION_PATH = '/embed/present';
4021
4021
  const DEFAULT_EDITOR_PATH = '/embed/edit';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AlgeoError, EMBED_ERROR_CODES, VERSION } from './shared';
2
2
  export type { FileContentLatest } from '@dajiaoai/algeo-protocol';
3
3
  export { convertToLatest } from '@dajiaoai/algeo-protocol';
4
- export type { AiApi, AiCancelEvent, AiRawSseEventV1, AiRequestEvent, AiRunPayloadV1, AiStreamEventV1, AlgeoCreateOptions, AlgeoEditorAuthOptions, AlgeoEditorCreateOptions, AlgeoEditorSaveResult, AlgeoEditorUiConfig, AlgeoEmbedMode, AlgeoErrorPayload, AlgeoFontConfig, AlgeoFontFormat, AlgeoFontOption, AlgeoFontResource, AlgeoFontSource, AlgeoPresentationCreateOptions, AlgeoPresentationUiConfig, ContentChangeEvent, DocumentApi, EmbeddedEditorEventListenerMap, EmbeddedEditorEventMap, EmbeddedEditorEventName, EmbeddedPresentationEventListenerMap, EmbeddedPresentationEventMap, EmbeddedPresentationEventName, ExportImageFormat, ExportImageOptions, ExportImageSizeMode, ExportImageViewMode, ExportImageContainMode, ExportViewBounds, ExportPadding, ExportSlideImageOptions, ExportedSlideImage, ExportSlideImageResult, ExportLatexOptions, ExportedLatex, ExportLatexResult, GetContentResult, GetSlideCountResult, HistoryApi, LoadFileResult, LoadShareByIdResult, ModeApi, PresentationModeApi, ReadyEvent, ResourceLibraryItem, ResourceLibraryPageInfo, ResourceLibraryProvider, ResourceLibraryQuery, ResourceLibraryQueryContext, ResourceLibraryResult, ReplResult, SlideChangeEvent, SlideIndexResult, SlidesApi, SwitchSlideResult, SaveEvent, } from './shared';
4
+ export type { AiApi, AiCancelEvent, AiRawSseEventV1, AiRequestEvent, AiRunPayloadV1, AiStreamEventV1, AlgeoCreateOptions, AlgeoEditorAuthOptions, AlgeoEditorCreateOptions, AlgeoEditorSaveResult, AlgeoEditorUiConfig, AlgeoEmbedMode, AlgeoErrorPayload, AlgeoFontConfig, AlgeoFontFormat, AlgeoFontOption, AlgeoFontResource, AlgeoFontSource, AlgeoPresentationCreateOptions, AlgeoPresentationUiConfig, ContentChangeEvent, DocumentApi, EmbeddedEditorEventListenerMap, EmbeddedEditorEventMap, EmbeddedEditorEventName, EmbeddedPresentationEventListenerMap, EmbeddedPresentationEventMap, EmbeddedPresentationEventName, ExportImageFormat, ExportImageOptions, ExportImageSizeMode, ExportImageViewMode, ExportImageContainMode, ExportViewBounds, ExportViewCamera3D, ExportPadding, ExportSlideImageOptions, ExportedSlideImage, ExportSlideImageResult, ExportLatexOptions, ExportedLatex, ExportLatexResult, GetContentResult, GetSlideCountResult, HistoryApi, LoadFileResult, LoadShareByIdResult, ModeApi, PresentationModeApi, ReadyEvent, ResourceLibraryItem, ResourceLibraryPageInfo, ResourceLibraryProvider, ResourceLibraryQuery, ResourceLibraryQueryContext, ResourceLibraryResult, ReplResult, SlideChangeEvent, SlideIndexResult, SlidesApi, SwitchSlideResult, SaveEvent, } from './shared';
5
5
  export { EmbeddedPresentation } from './embedded-presentation';
6
6
  export { EmbeddedEditor } from './embedded-editor';
7
7
  export { AlgeoSdk, create, createEditor, createPresentation, type EmbeddedInstance, } from './sdk';
package/dist/shared.d.ts CHANGED
@@ -262,6 +262,19 @@ export interface ExportViewBounds {
262
262
  */
263
263
  scale?: number;
264
264
  }
265
+ /**
266
+ * 3D 画板的导出相机覆盖项。未提供的字段沿用画板当前 camera3d。
267
+ */
268
+ export interface ExportViewCamera3D {
269
+ offset?: [number, number, number];
270
+ pitch?: number;
271
+ yaw?: number;
272
+ scale?: number;
273
+ /** 3D 导出视野的世界坐标宽度。 */
274
+ width: number;
275
+ /** 3D 导出视野的世界坐标高度。 */
276
+ height: number;
277
+ }
265
278
  /** 导出留白,单位为输出像素 px。 */
266
279
  export type ExportPadding = number | {
267
280
  horizontal?: number;
@@ -292,7 +305,10 @@ export interface ExportImageSizeMode extends ExportImageBaseOptions {
292
305
  */
293
306
  export interface ExportImageViewMode extends ExportImageBaseOptions {
294
307
  mode: 'view';
295
- viewBounds: ExportViewBounds;
308
+ /** 2D 画板的世界坐标视野。 */
309
+ viewBounds?: ExportViewBounds;
310
+ /** 3D 画板的相机视野。 */
311
+ viewCamera3d?: ExportViewCamera3D;
296
312
  pixelRatio?: number;
297
313
  }
298
314
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dajiaoai/algeo-sdk",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "大角几何内嵌画板 SDK,支持 iframe 挂载与 postMessage 通信",
5
5
  "main": "dist/algeo-sdk.cjs.js",
6
6
  "module": "dist/algeo-sdk.esm.js",