@univerjs/engine-render 0.6.0 → 0.6.1-nightly.202502221605

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.
@@ -21,3 +21,4 @@ export * from './row-header';
21
21
  export * from './sheet-component';
22
22
  export * from './sheet.render-skeleton';
23
23
  export * from './spreadsheet';
24
+ export * from './watermark';
@@ -0,0 +1,20 @@
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
+ export * from './type';
17
+ export * from './util';
18
+ export * from './watermark-layer';
19
+ export declare const UNIVER_WATERMARK_STORAGE_KEY = "UNIVER_WATERMARK_STORAGE_KEY";
20
+ export declare const UNIVER_WATERMARK_LAYER_INDEX = 10;
@@ -0,0 +1,59 @@
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
+ export declare enum IWatermarkTypeEnum {
17
+ UserInfo = "userInfo",
18
+ Text = "text",
19
+ Image = "image"
20
+ }
21
+ export interface IGeneralWatermarkConfig {
22
+ x: number;
23
+ y: number;
24
+ repeat: boolean;
25
+ spacingX: number;
26
+ spacingY: number;
27
+ rotate: number;
28
+ opacity: number;
29
+ }
30
+ export interface ITextWatermarkConfig extends IGeneralWatermarkConfig {
31
+ content?: string;
32
+ fontSize: number;
33
+ color: string;
34
+ bold: boolean;
35
+ italic: boolean;
36
+ direction: 'ltr' | 'rtl' | 'inherit';
37
+ }
38
+ export interface IImageWatermarkConfig extends IGeneralWatermarkConfig {
39
+ url: string;
40
+ width: number;
41
+ height: number;
42
+ maintainAspectRatio: boolean;
43
+ originRatio: number;
44
+ }
45
+ export interface IUserInfoWatermarkConfig extends IGeneralWatermarkConfig, Omit<ITextWatermarkConfig, 'content'> {
46
+ name: boolean;
47
+ email: boolean;
48
+ phone: boolean;
49
+ uid: boolean;
50
+ }
51
+ export interface IWatermarkConfig {
52
+ text?: ITextWatermarkConfig;
53
+ image?: IImageWatermarkConfig;
54
+ userInfo?: IUserInfoWatermarkConfig;
55
+ }
56
+ export interface IWatermarkConfigWithType {
57
+ config: IWatermarkConfig;
58
+ type: IWatermarkTypeEnum;
59
+ }
@@ -0,0 +1,7 @@
1
+ import { IUser, Nullable } from '@univerjs/core';
2
+ import { UniverRenderingContext } from '../../../context';
3
+ import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig, IWatermarkConfigWithType } from './type';
4
+ export declare function renderWatermark(ctx: UniverRenderingContext, config: IWatermarkConfigWithType, image: Nullable<HTMLImageElement>, userInfo: Nullable<IUser>): void;
5
+ export declare function renderUserInfoWatermark(ctx: UniverRenderingContext, config: IUserInfoWatermarkConfig, userInfo: Nullable<IUser>): void;
6
+ export declare function renderTextWatermark(ctx: UniverRenderingContext, config: ITextWatermarkConfig): void;
7
+ export declare function renderImageWatermark(ctx: UniverRenderingContext, config: IImageWatermarkConfig, image: Nullable<HTMLImageElement>): void;
@@ -0,0 +1,12 @@
1
+ import { IUser } from '@univerjs/core';
2
+ import { UniverRenderingContext } from '../../../context';
3
+ import { IWatermarkConfigWithType } from './type';
4
+ import { Layer } from '../../../layer';
5
+ export declare class WatermarkLayer extends Layer {
6
+ private _config;
7
+ private _image;
8
+ private _user;
9
+ render(ctx?: UniverRenderingContext, isMaxLayer?: boolean): this;
10
+ updateConfig(config?: IWatermarkConfigWithType, user?: IUser): void;
11
+ private _renderWatermark;
12
+ }
@@ -281,7 +281,7 @@ export declare class Scene extends Disposable {
281
281
  };
282
282
  dispose(): void;
283
283
  /**
284
- * Get the object under the pointer, if scene.event is disabled, the object is null.
284
+ * Get the object under the pointer, if scene.event is disabled, return null.
285
285
  * @param {Vector2} coord
286
286
  * @return {Nullable<BaseObject | Scene>} object under the pointer
287
287
  */
@@ -315,4 +315,8 @@ export declare class Scene extends Disposable {
315
315
  */
316
316
  disableObjectsEvent(): void;
317
317
  enableObjectsEvent(): void;
318
+ _capturedObject: BaseObject | null;
319
+ get capturedObject(): BaseObject | null;
320
+ setCaptureObject(o: BaseObject): void;
321
+ releaseCapturedObject(): void;
318
322
  }
@@ -1,3 +1,4 @@
1
+ import { BaseObject } from './base-object';
1
2
  import { IDragEvent, IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
2
3
  import { ISceneInputControlOptions, Scene } from './scene';
3
4
  import { Disposable } from '@univerjs/core';
@@ -49,12 +50,20 @@ export declare class InputManager extends Disposable {
49
50
  */
50
51
  detachControl(): void;
51
52
  /**
52
- * Just call this._scene.pick, nothing special.
53
+ * Get the object under the pointer, if scene.event is disabled, return null.
53
54
  * @param offsetX
54
55
  * @param offsetY
55
56
  */
56
57
  private _getObjectAtPos;
57
- private _checkDirectSceneEventTrigger;
58
+ /**
59
+ *
60
+ * If currentObject is null, return true
61
+ * @param isTrigger
62
+ * @param currentObject
63
+ * @returns
64
+ */
65
+ private _shouldDispatchEventToScene;
66
+ private _isObjectInSceneViewer;
58
67
  /**
59
68
  * @hidden
60
69
  * @returns Boolean if delta for pointer exceeds drag movement threshold
@@ -62,4 +71,5 @@ export declare class InputManager extends Disposable {
62
71
  private _isPointerSwiping;
63
72
  private _prePointerDoubleOrTripleClick;
64
73
  private _resetDoubleClickParam;
74
+ get capturedObject(): BaseObject | null;
65
75
  }
@@ -1,8 +1,8 @@
1
+ import { Nullable, Disposable } from '@univerjs/core';
1
2
  import { Vector2 } from '../basics/vector2';
2
3
  import { UniverRenderingContext } from '../context';
3
4
  import { Scene } from '../scene';
4
5
  import { Rect } from './rect';
5
- import { Disposable, Nullable } from '@univerjs/core';
6
6
  export interface IScrollBarProps {
7
7
  thumbMargin?: number;
8
8
  thumbLengthRatio?: number;
@@ -25,14 +25,14 @@ export interface IScrollBarProps {
25
25
  export declare abstract class BaseScrollBar extends Disposable {
26
26
  enableHorizontal: boolean;
27
27
  enableVertical: boolean;
28
- horizontalThumbWidth: number;
28
+ horizontalThumbSize: number;
29
29
  horizontalMinusMiniThumb: number;
30
30
  horizontalBarWidth: number;
31
- verticalThumbHeight: number;
32
- verticalBarHeight: number;
33
- verticalMinusMiniThumb: number;
34
31
  horizonScrollTrack: Nullable<Rect>;
35
32
  horizonThumbRect: Nullable<Rect>;
33
+ verticalThumbSize: number;
34
+ verticalBarHeight: number;
35
+ verticalMinusMiniThumb: number;
36
36
  verticalScrollTrack: Nullable<Rect>;
37
37
  verticalThumbRect: Nullable<Rect>;
38
38
  placeholderBarRect: Nullable<Rect>;
@@ -15,10 +15,15 @@ export declare class ScrollBar extends BaseScrollBar {
15
15
  private _verticalPointerMoveSub;
16
16
  private _verticalPointerUpSub;
17
17
  /**
18
- * The thickness of a scrolling bar.
18
+ * The thickness of a scrolling track
19
+ * ThumbSize = barSize - thumbMargin * 2
19
20
  */
20
21
  barSize: number;
21
22
  barBorder: number;
23
+ /**
24
+ * The margin between thumb and bar.
25
+ * ThumbSize = barSize - thumbMargin * 2
26
+ */
22
27
  thumbMargin: number;
23
28
  thumbLengthRatio: number;
24
29
  /**
@@ -38,6 +43,7 @@ export declare class ScrollBar extends BaseScrollBar {
38
43
  */
39
44
  minThumbSizeV: number;
40
45
  private _eventSub;
46
+ get scrollHandleThickness(): number;
41
47
  constructor(view: Viewport, props?: IScrollBarProps);
42
48
  static attachTo(view: Viewport, props?: IScrollBarProps): ScrollBar;
43
49
  dispose(): void;