@univerjs/docs-drawing-ui 1.0.4 → 1.2.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.
@@ -46,11 +46,11 @@ export declare class DocDrawingTransformerController extends Disposable {
46
46
  private _transformerCache;
47
47
  private _anchorShape;
48
48
  constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _drawingManagerService: IDrawingManagerService, _renderManagerService: IRenderManagerService);
49
+ dispose(): void;
49
50
  private _init;
50
51
  private _listenDrawingFocus;
51
52
  private _listenTransformerChange;
52
53
  private _updateMultipleDrawingDocTransform;
53
- private _updateDrawingAnchor;
54
54
  private _updateInlineDrawingAnchor;
55
55
  private _getInlineDrawingAnchor;
56
56
  private _getDrawingAnchor;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { DocumentDataModel } from '@univerjs/core';
17
+ import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
+ import { Disposable, ThemeService } from '@univerjs/core';
19
+ import { DocSkeletonManagerService } from '@univerjs/docs';
20
+ import { DocSelectionRenderService } from '@univerjs/docs-ui';
21
+ import { IDrawingManagerService } from '@univerjs/drawing';
22
+ export declare class DocDrawingAnchorRenderController extends Disposable implements IRenderModule {
23
+ private readonly _context;
24
+ private readonly _skeletonManager;
25
+ private readonly _selectionRender;
26
+ private readonly _themeService;
27
+ private _stroke;
28
+ private _focused;
29
+ private readonly _markers;
30
+ constructor(_context: IRenderContext<DocumentDataModel>, drawingManager: IDrawingManagerService, _skeletonManager: DocSkeletonManagerService, _selectionRender: DocSelectionRenderService, _themeService: ThemeService);
31
+ private _updateMarkers;
32
+ }
@@ -38,7 +38,10 @@ interface IDrawingClipBounds {
38
38
  width: number;
39
39
  height: number;
40
40
  }
41
- type DrawingRefreshParam = Partial<IDrawingParam & IDrawingParamsWithBehindText>;
41
+ type DrawingRefreshParam = Partial<IDrawingParam> & {
42
+ behindText?: boolean;
43
+ customBlockRenderViewport?: IDrawingParamsWithBehindText['customBlockRenderViewport'];
44
+ };
42
45
  export declare function shouldRefreshDocDrawingTransform(current: DrawingRefreshParam | null | undefined, next: DrawingRefreshParam): boolean;
43
46
  /**
44
47
  * Overlay drawings do not participate in text layout. While their skeleton
@@ -110,6 +113,7 @@ export declare function getDocsPageRelativeDrawingLeft(config: {
110
113
  positionH: {
111
114
  align?: AlignTypeH;
112
115
  posOffset?: number;
116
+ percent?: number;
113
117
  relativeFrom?: ObjectRelativeFromH;
114
118
  };
115
119
  width: number;
@@ -119,6 +123,7 @@ export declare function getDocsPageRelativeDrawingTop(config: {
119
123
  positionV: {
120
124
  align?: AlignTypeV;
121
125
  posOffset?: number;
126
+ percent?: number;
122
127
  relativeFrom?: ObjectRelativeFromV;
123
128
  };
124
129
  height: number;
@@ -151,6 +156,8 @@ export declare class DocDrawingTransformUpdateController extends Disposable impl
151
156
  private _lifecycleService;
152
157
  private _liquid;
153
158
  private _changesetDrawingRefreshScheduled;
159
+ private _pendingMultiDrawingSelection;
160
+ private _pendingMultiDrawingSelectionSubscription?;
154
161
  private readonly _publicationTracker;
155
162
  constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService, _commandService: ICommandService, _editorService: IEditorService, _drawingManagerService: IDrawingManagerService, _docRefreshDrawingsService: DocRefreshDrawingsService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
156
163
  private _initialize;
@@ -165,6 +172,8 @@ export declare class DocDrawingTransformUpdateController extends Disposable impl
165
172
  private _collectSegmentDrawingPositions;
166
173
  private _getStaleNonMultiDrawings;
167
174
  private _handleMultiDrawingsTransform;
175
+ private _clearPendingMultiDrawingSelection;
176
+ private _restoreMultiDrawingSelection;
168
177
  private _calculateDrawingPosition;
169
178
  private _collectDrawingPosition;
170
179
  private _collectGroupChildren;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDocumentData } from '@univerjs/core';
17
+ import type { ISuccinctDocRangeParam } from '@univerjs/engine-render';
18
+ /** Locate the persisted object character without consulting the active text selection. */
19
+ export declare function findDrawingTextAnchor(snapshot: IDocumentData, drawingId: string): {
20
+ offset: number;
21
+ segmentId: string;
22
+ } | null;
23
+ /** Preserve keyboard/clipboard object ranges while replacing floating selection paint with an anchor icon. */
24
+ export declare function getDrawingTextRanges(snapshot: IDocumentData, drawingIds: string[]): ISuccinctDocRangeParam[];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IDocDrawingPosition, IDocumentData, LocaleService } from '@univerjs/core';
17
+ import type { IDocumentSkeletonCached, IDocumentSkeletonDrawing, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage } from '@univerjs/engine-render';
18
+ import { ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType } from '@univerjs/core';
19
+ import { DocumentEditArea } from '@univerjs/engine-render';
20
+ export interface IDrawingAnchorInPage {
21
+ skeDrawing: IDocumentSkeletonDrawing;
22
+ page: IDocumentSkeletonPage | IDocumentSkeletonHeaderFooter;
23
+ hostPage?: IDocumentSkeletonPage;
24
+ pageMarginTop: number;
25
+ pageMarginLeft: number;
26
+ }
27
+ export declare function findDrawingAnchor(unitId: string, drawingId: string, skeleton: IDocumentSkeletonCached, editArea: DocumentEditArea, currentDrawing?: IDocumentSkeletonDrawing['drawingOrigin']): IDrawingAnchorInPage | null;
28
+ /** Resolve a text-relative origin before committing a wrapping reference change. */
29
+ export declare function resolveDrawingWrappingPosition(anchor: IDrawingAnchorInPage, position: IDocDrawingPosition, snapshot: IDocumentData, localeService: LocaleService, editArea: DocumentEditArea): IDocDrawingPosition | null;
30
+ /** Preserve the rendered position when text wrapping or a positioning reference changes. */
31
+ export declare function getDrawingWrappingPosition(anchor: IDrawingAnchorInPage, layoutType: PositionedObjectLayoutType, relativeFromH?: ObjectRelativeFromH, relativeFromV?: ObjectRelativeFromV, offset?: {
32
+ left: number;
33
+ top: number;
34
+ }): IDocDrawingPosition;
@@ -37,7 +37,7 @@ export declare function useDocDrawingPosition(props: IDocDrawingPositionProps):
37
37
  value: string;
38
38
  disabled?: undefined;
39
39
  })[];
40
- handlePositionChange: (direction: "positionH" | "positionV", value: IObjectPositionH | IObjectPositionV) => void;
40
+ handlePositionChange: (direction: "positionH" | "positionV", value: IObjectPositionH | IObjectPositionV, positionH?: IObjectPositionH) => void;
41
41
  handleHorizontalRelativeFromChange: (value: string) => void;
42
42
  handleVerticalRelativeFromChange: (value: string) => void;
43
43
  handleFollowTextMoveCheck: (val: string | number | boolean) => void;