@dajiaoai/algeo-sdk 2.9.2 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -292,11 +292,20 @@ type AlgeoCreateOptions =
292
292
 
293
293
  **AlgeoPresentationCreateOptions:**
294
294
 
295
- | 属性 | 类型 | 默认值 | 说明 |
296
- | --------- | ------------------------------------ | ------ | -------------------------------------------------------- |
297
- | `auth` | `{ appId: string }` | - | 演示模式鉴权参数,`appId` 用于路由及白名单校验 |
295
+ | 属性 | 类型 | 默认值 | 说明 |
296
+ | --------- | ------------------------------------ | ------ | --------------------------------------------------------- |
297
+ | `auth` | `{ appId: string }` | - | 演示模式鉴权参数,`appId` 用于路由及白名单校验 |
298
298
  | `shareId` | `string` | `''` | 演示模式初始分享 ID,会映射到 `/embed/present/:appId/:id` |
299
- | `ui` | `Partial<AlgeoPresentationUiConfig>` | - | 演示模式 UI 配置 |
299
+ | `ui` | `Partial<AlgeoPresentationUiConfig>` | - | 演示模式 UI 配置 |
300
+
301
+ **AlgeoPresentationUiConfig:**
302
+
303
+ | 属性 | 类型 | 默认值 | 说明 |
304
+ | --------------- | --------- | ------ | ------------------ |
305
+ | `logo` | `boolean` | `true` | 是否展示 logo |
306
+ | `slidePanel` | `boolean` | `true` | 是否展示画板管理器 |
307
+ | `pencilToolbar` | `boolean` | `true` | 是否展示教具栏 |
308
+ | `zoomControl` | `boolean` | `true` | 是否展示缩放栏 |
300
309
 
301
310
  默认路径规则:
302
311
 
@@ -488,12 +497,12 @@ const images = await editor.slides.exportImage({
488
497
  mode: 'view',
489
498
  slideIndices: [1],
490
499
  format: 'png',
491
- viewBounds: { x: -5, y: -5, width: 10, height: 10 },
500
+ viewBounds: { x: -5, y: -5, width: 10, height: 10, scale: 50 },
492
501
  pixelRatio: 2,
493
502
  });
494
503
  ```
495
504
 
496
- `viewBounds` 的位置和宽高均为世界坐标。输出尺寸为 `viewBounds × camera.scale × pixelRatio`。
505
+ `viewBounds` 的位置和宽高均为世界坐标,`scale` 为可选的相机缩放比例。省略 `scale` 时使用目标画板文件中的 `camera.scale`。
497
506
 
498
507
  适合完整包住全部内容且不限定最终宽高时使用 `contain`:
499
508
 
@@ -4011,7 +4011,7 @@ function convertToLatest(content) {
4011
4011
  }
4012
4012
 
4013
4013
  /** SDK 版本号,构建时由 rollup 注入 */
4014
- const VERSION = '2.9.2';
4014
+ const VERSION = '2.10.0';
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';
@@ -4356,7 +4356,12 @@ class EmbeddedPresentation extends EmbeddedTarget {
4356
4356
  super(container, 'presentation');
4357
4357
  this.currentSlideIndex = 0;
4358
4358
  this.slideCount = 0;
4359
- this.uiConfig = {};
4359
+ this.uiConfig = {
4360
+ logo: true,
4361
+ slidePanel: true,
4362
+ pencilToolbar: true,
4363
+ zoomControl: true,
4364
+ };
4360
4365
  this.mode = {
4361
4366
  getUiConfig: () => ({ ...this.uiConfig }),
4362
4367
  setUiConfig: async (config) => {
@@ -4373,15 +4378,19 @@ class EmbeddedPresentation extends EmbeddedTarget {
4373
4378
  };
4374
4379
  }
4375
4380
  async initialize(options = {}, baseUrl) {
4376
- this.uiConfig = options.ui ? { ...options.ui } : {};
4381
+ this.uiConfig = {
4382
+ logo: true,
4383
+ slidePanel: true,
4384
+ pencilToolbar: true,
4385
+ zoomControl: true,
4386
+ ...options.ui,
4387
+ };
4377
4388
  await this.init({
4378
4389
  baseUrl,
4379
4390
  auth: options.auth,
4380
4391
  initialId: options.shareId,
4381
4392
  });
4382
- if (Object.keys(this.uiConfig).length > 0) {
4383
- await this.mode.setUiConfig(this.uiConfig);
4384
- }
4393
+ await this.mode.setUiConfig(this.uiConfig);
4385
4394
  }
4386
4395
  acceptsEventMessage() {
4387
4396
  return false;
@@ -4009,7 +4009,7 @@ function convertToLatest(content) {
4009
4009
  }
4010
4010
 
4011
4011
  /** SDK 版本号,构建时由 rollup 注入 */
4012
- const VERSION = '2.9.2';
4012
+ const VERSION = '2.10.0';
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';
@@ -4354,7 +4354,12 @@ class EmbeddedPresentation extends EmbeddedTarget {
4354
4354
  super(container, 'presentation');
4355
4355
  this.currentSlideIndex = 0;
4356
4356
  this.slideCount = 0;
4357
- this.uiConfig = {};
4357
+ this.uiConfig = {
4358
+ logo: true,
4359
+ slidePanel: true,
4360
+ pencilToolbar: true,
4361
+ zoomControl: true,
4362
+ };
4358
4363
  this.mode = {
4359
4364
  getUiConfig: () => ({ ...this.uiConfig }),
4360
4365
  setUiConfig: async (config) => {
@@ -4371,15 +4376,19 @@ class EmbeddedPresentation extends EmbeddedTarget {
4371
4376
  };
4372
4377
  }
4373
4378
  async initialize(options = {}, baseUrl) {
4374
- this.uiConfig = options.ui ? { ...options.ui } : {};
4379
+ this.uiConfig = {
4380
+ logo: true,
4381
+ slidePanel: true,
4382
+ pencilToolbar: true,
4383
+ zoomControl: true,
4384
+ ...options.ui,
4385
+ };
4375
4386
  await this.init({
4376
4387
  baseUrl,
4377
4388
  auth: options.auth,
4378
4389
  initialId: options.shareId,
4379
4390
  });
4380
- if (Object.keys(this.uiConfig).length > 0) {
4381
- await this.mode.setUiConfig(this.uiConfig);
4382
- }
4391
+ await this.mode.setUiConfig(this.uiConfig);
4383
4392
  }
4384
4393
  acceptsEventMessage() {
4385
4394
  return false;
@@ -4015,7 +4015,7 @@
4015
4015
  }
4016
4016
 
4017
4017
  /** SDK 版本号,构建时由 rollup 注入 */
4018
- const VERSION = '2.9.2';
4018
+ const VERSION = '2.10.0';
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';
@@ -4360,7 +4360,12 @@
4360
4360
  super(container, 'presentation');
4361
4361
  this.currentSlideIndex = 0;
4362
4362
  this.slideCount = 0;
4363
- this.uiConfig = {};
4363
+ this.uiConfig = {
4364
+ logo: true,
4365
+ slidePanel: true,
4366
+ pencilToolbar: true,
4367
+ zoomControl: true,
4368
+ };
4364
4369
  this.mode = {
4365
4370
  getUiConfig: () => ({ ...this.uiConfig }),
4366
4371
  setUiConfig: async (config) => {
@@ -4377,15 +4382,19 @@
4377
4382
  };
4378
4383
  }
4379
4384
  async initialize(options = {}, baseUrl) {
4380
- this.uiConfig = options.ui ? { ...options.ui } : {};
4385
+ this.uiConfig = {
4386
+ logo: true,
4387
+ slidePanel: true,
4388
+ pencilToolbar: true,
4389
+ zoomControl: true,
4390
+ ...options.ui,
4391
+ };
4381
4392
  await this.init({
4382
4393
  baseUrl,
4383
4394
  auth: options.auth,
4384
4395
  initialId: options.shareId,
4385
4396
  });
4386
- if (Object.keys(this.uiConfig).length > 0) {
4387
- await this.mode.setUiConfig(this.uiConfig);
4388
- }
4397
+ await this.mode.setUiConfig(this.uiConfig);
4389
4398
  }
4390
4399
  acceptsEventMessage() {
4391
4400
  return false;
package/dist/shared.d.ts CHANGED
@@ -29,6 +29,9 @@ export interface AlgeoEditorUiConfig {
29
29
  }
30
30
  export interface AlgeoPresentationUiConfig {
31
31
  logo?: boolean;
32
+ slidePanel?: boolean;
33
+ pencilToolbar?: boolean;
34
+ zoomControl?: boolean;
32
35
  }
33
36
  export type AlgeoEditorSaveResult = {
34
37
  status: 'success';
@@ -171,6 +174,11 @@ export interface ExportViewBounds {
171
174
  y: number;
172
175
  width: number;
173
176
  height: number;
177
+ /**
178
+ * 相机缩放比例(每世界坐标单位对应的像素数)。
179
+ * 省略时使用目标画板文件中的 camera.scale。
180
+ */
181
+ scale?: number;
174
182
  }
175
183
  /** 导出留白,单位为输出像素 px。 */
176
184
  export type ExportPadding = number | {
@@ -196,8 +204,9 @@ export interface ExportImageSizeMode extends ExportImageBaseOptions {
196
204
  minPadding?: ExportPadding;
197
205
  }
198
206
  /**
199
- * 场景二(view):viewBounds 的位置及宽高均为世界坐标,渲染相机从文件读取
200
- * 输出像素 = viewBounds 世界尺寸 x camera.scale x pixelRatio。
207
+ * 场景二(view):viewBounds 的位置及宽高均为世界坐标。
208
+ * scale 省略时从文件的 camera.scale 读取。
209
+ * 输出像素 = viewBounds 世界尺寸 x viewBounds.scale x pixelRatio。
201
210
  */
202
211
  export interface ExportImageViewMode extends ExportImageBaseOptions {
203
212
  mode: 'view';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dajiaoai/algeo-sdk",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "大角几何内嵌画板 SDK,支持 iframe 挂载与 postMessage 通信",
5
5
  "main": "dist/algeo-sdk.cjs.js",
6
6
  "module": "dist/algeo-sdk.esm.js",