mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 16:53:06 +08:00
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;
|
||||
|
||||
enum KonvaNodeEvent {
|
||||
@@ -139,7 +139,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;
|
||||
@@ -248,13 +289,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;
|
||||
@@ -311,6 +353,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: KonvaEventString, handler: HandlerFunc): this;
|
||||
opacity(): number;
|
||||
opacity(opacity: number): this;
|
||||
@@ -940,6 +983,7 @@ declare namespace Konva {
|
||||
padding?: number;
|
||||
lineHeight?: number;
|
||||
wrap?: string;
|
||||
ellipsis?: boolean;
|
||||
}
|
||||
|
||||
class Text extends Shape {
|
||||
|
||||
Reference in New Issue
Block a user