@univerjs/engine-render 0.19.0 → 0.20.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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/scene.input-manager.d.ts +0 -2
- package/lib/types/shape/image.d.ts +30 -4
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
|
@@ -45,8 +45,6 @@ export declare class InputManager extends Disposable {
|
|
|
45
45
|
dispose(): void;
|
|
46
46
|
mouseLeaveEnterHandler(evt: IMouseEvent): void;
|
|
47
47
|
dragLeaveEnterHandler(evt: IDragEvent): void;
|
|
48
|
-
private _clickTimeout;
|
|
49
|
-
private _clickCount;
|
|
50
48
|
_onClick(evt: IPointerEvent): void;
|
|
51
49
|
_onDblClick(evt: IPointerEvent): void;
|
|
52
50
|
_onPointerEnter(evt: IPointerEvent): void;
|
|
@@ -13,13 +13,29 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ISrcRect, Nullable
|
|
16
|
+
import type { ISrcRect, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IObjectFullState, IViewportInfo } from '../basics';
|
|
18
18
|
import type { UniverRenderingContext } from '../context';
|
|
19
19
|
import type { IShapeProps } from './shape';
|
|
20
20
|
import { ObjectType } from '../base-object';
|
|
21
21
|
import { RENDER_CLASS_TYPE, Transform, Vector2 } from '../basics';
|
|
22
22
|
import { Shape } from './shape';
|
|
23
|
+
export interface IShapeClipBounds {
|
|
24
|
+
left: number;
|
|
25
|
+
top: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
29
|
+
export interface IImageShapeClipService {
|
|
30
|
+
/**
|
|
31
|
+
* Build the shape outline path and clip the canvas context.
|
|
32
|
+
* Assumes the coordinate system has (0,0) at the top-left of the shape area.
|
|
33
|
+
* The method calls ctx.beginPath(), builds the shape path, and calls ctx.clip().
|
|
34
|
+
* @returns The actual bounding rect of the clip region, or false if no clip was built.
|
|
35
|
+
* For multi-path shapes the bounds may extend beyond (0, 0, width, height).
|
|
36
|
+
*/
|
|
37
|
+
applyShapeClip(ctx: UniverRenderingContext, prstGeom: string, width: number, height: number, adjustValues?: Nullable<Record<string, number>>): IShapeClipBounds | false;
|
|
38
|
+
}
|
|
23
39
|
export interface IImageProps extends IShapeProps {
|
|
24
40
|
image?: HTMLImageElement;
|
|
25
41
|
url?: string;
|
|
@@ -32,7 +48,12 @@ export interface IImageProps extends IShapeProps {
|
|
|
32
48
|
/**
|
|
33
49
|
* 20.1.9.18 prstGeom (Preset geometry)
|
|
34
50
|
*/
|
|
35
|
-
prstGeom?: Nullable<
|
|
51
|
+
prstGeom?: Nullable<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Adjust values for the preset geometry (e.g. corner radius for roundRect).
|
|
54
|
+
* Keys are adjust handle names, values are numeric values.
|
|
55
|
+
*/
|
|
56
|
+
adjustValues?: Nullable<Record<string, number>>;
|
|
36
57
|
opacity?: number;
|
|
37
58
|
}
|
|
38
59
|
export declare class Image extends Shape<IImageProps> {
|
|
@@ -40,18 +61,23 @@ export declare class Image extends Shape<IImageProps> {
|
|
|
40
61
|
protected _native: Nullable<HTMLImageElement>;
|
|
41
62
|
private _renderByCropper;
|
|
42
63
|
private _transformCalculateSrcRect;
|
|
64
|
+
private _clipService;
|
|
43
65
|
objectType: ObjectType;
|
|
44
66
|
isDrawingObject: boolean;
|
|
45
67
|
constructor(id: string, config: IImageProps);
|
|
46
68
|
get srcRect(): Nullable<ISrcRect>;
|
|
47
|
-
get prstGeom(): Nullable<
|
|
69
|
+
get prstGeom(): Nullable<string>;
|
|
48
70
|
get opacity(): number;
|
|
49
71
|
setOpacity(opacity: number): void;
|
|
72
|
+
setClipService(clipService: Nullable<IImageShapeClipService>): void;
|
|
73
|
+
getClipService(): Nullable<IImageShapeClipService>;
|
|
50
74
|
get classType(): RENDER_CLASS_TYPE;
|
|
51
75
|
transformByStateCloseCropper(option: IObjectFullState): void;
|
|
52
76
|
changeSource(url: string): void;
|
|
53
77
|
resetSize(): void;
|
|
54
|
-
setPrstGeom(prstGeom?: Nullable<
|
|
78
|
+
setPrstGeom(prstGeom?: Nullable<string>): void;
|
|
79
|
+
setPrstGeomAdjValues(adjValues?: Nullable<Record<string, number>>): void;
|
|
80
|
+
get prstGeomAdjValues(): Nullable<Record<string, number>>;
|
|
55
81
|
setSrcRect(srcRect?: Nullable<ISrcRect>): void;
|
|
56
82
|
getProps(): IImageProps;
|
|
57
83
|
getNative(): Nullable<HTMLImageElement>;
|