mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
Updated Konva.d.ts
Added KonvaNodeEventMap to determine event type correctly based on eventString similar to lib.es6.d.ts. and added missing type definitions.
This commit is contained in:
parent
87820449ad
commit
a2c5920d4d
48
konva.d.ts
vendored
48
konva.d.ts
vendored
@ -6,7 +6,7 @@ declare namespace Konva {
|
||||
var DD: any;
|
||||
|
||||
type HandlerFunc = (
|
||||
e: { target: Konva.Shape; evt: Event; currentTarget: Konva.Node }
|
||||
e: { target: Konva.Shape; evt: Event; currentTarget: Konva.Node; cancelBubble: boolean }
|
||||
) => void;
|
||||
|
||||
type globalCompositeOperationType =
|
||||
@ -96,7 +96,48 @@ declare namespace Konva {
|
||||
start(): Animation;
|
||||
stop(): Animation;
|
||||
}
|
||||
|
||||
interface KonvaNodeEventMap extends KonvaStageEventMap {
|
||||
'mouseover': MouseEvent,
|
||||
'mouseout': MouseEvent,
|
||||
'mousemove': MouseEvent,
|
||||
'mouseleave': MouseEvent,
|
||||
'mouseenter': MouseEvent,
|
||||
'mousedown': MouseEvent,
|
||||
'mouseup': MouseEvent,
|
||||
'wheel': WheelEvent,
|
||||
'contextmenu': PointerEvent,
|
||||
'click': MouseEvent,
|
||||
'dblclick': MouseEvent,
|
||||
'touchstart': TouchEvent,
|
||||
'touchmove': TouchEvent,
|
||||
'touchend': TouchEvent,
|
||||
'tap': Event,
|
||||
'dbltap': Event,
|
||||
'dragstart': DragEvent,
|
||||
'dragmove': DragEvent,
|
||||
'dragend': DragEvent,
|
||||
'dragover': DragEvent,
|
||||
'drop': DragEvent,
|
||||
}
|
||||
|
||||
interface KonvaStageEventMap {
|
||||
'contentMouseover': MouseEvent,
|
||||
'contentMousemove': MouseEvent,
|
||||
'contentMouseout': MouseEvent,
|
||||
'contentMousedown': MouseEvent,
|
||||
'contentMouseup': MouseEvent,
|
||||
'contentWheel': WheelEvent,
|
||||
'contentContextmenu': PointerEvent,
|
||||
'contentClick': MouseEvent,
|
||||
'contentDblclick': MouseEvent,
|
||||
'contentTouchstart': TouchEvent,
|
||||
'contentTouchmove': TouchEvent,
|
||||
'contentTouchend': TouchEvent,
|
||||
'contentTap': Event,
|
||||
'contentDblTap': Event,
|
||||
}
|
||||
|
||||
interface NodeConfig {
|
||||
x?: number;
|
||||
y?: number;
|
||||
@ -205,13 +246,14 @@ declare namespace Konva {
|
||||
getAbsolutePosition(top?: Container): Vector2d;
|
||||
getAbsoluteTransform(top?: Container): Transform;
|
||||
getAbsoluteZIndex(): number;
|
||||
getAbsoluteScale(): Vector2d;
|
||||
getAncestors(): Collection;
|
||||
getAttr(attr: string): any;
|
||||
getAttrs(): NodeConfig;
|
||||
// CHECK
|
||||
getCanvas(): Canvas;
|
||||
getClassName(): string;
|
||||
getClientRect(): SizeConfig;
|
||||
getClientRect(attrs? : { skipTransform?: boolean, relativeTo?: object }): SizeConfig;
|
||||
getContent(): HTMLDivElement;
|
||||
getDepth(): number;
|
||||
getHeight(): number;
|
||||
@ -268,6 +310,7 @@ declare namespace Konva {
|
||||
offsetX(offsetX: number): this;
|
||||
offsetY(): number;
|
||||
offsetY(offsetY: number): this;
|
||||
on<K extends keyof KonvaNodeEventMap>(evtStr: K, handler: (e: { target: Konva.Shape; evt: KonvaNodeEventMap[K]; currentTarget: Konva.Node; cancelBubble: boolean }) => void): this;
|
||||
on(evtStr: string, handler: HandlerFunc): this;
|
||||
opacity(): number;
|
||||
opacity(opacity: number): this;
|
||||
@ -897,6 +940,7 @@ declare namespace Konva {
|
||||
padding?: number;
|
||||
lineHeight?: number;
|
||||
wrap?: string;
|
||||
ellipsis?: boolean;
|
||||
}
|
||||
|
||||
class Text extends Shape {
|
||||
|
Loading…
Reference in New Issue
Block a user