mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
docs and types
This commit is contained in:
15
src/Node.ts
15
src/Node.ts
@@ -1183,6 +1183,21 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
y: this.y(),
|
||||
};
|
||||
}
|
||||
/**
|
||||
* get absolute position of a node. That function can be used to calculate absolute position, but relative to any ancestor
|
||||
* @method
|
||||
* @name Konva.Node#getAbsolutePosition
|
||||
* @param {Object} Ancestor optional ancestor node
|
||||
* @returns {Konva.Node}
|
||||
* @example
|
||||
*
|
||||
* // returns absolute position relative to top-left corner of canvas
|
||||
* node.getAbsolutePosition();
|
||||
*
|
||||
* // calculate absolute position of node, inside stage
|
||||
* // so stage transforms are ignored
|
||||
* node.getAbsolutePosition(stage)
|
||||
*/
|
||||
getAbsolutePosition(top?) {
|
||||
let haveCachedParent = false;
|
||||
let parent = this.parent;
|
||||
|
@@ -599,7 +599,9 @@ export const Util = {
|
||||
},
|
||||
_sign(number: number) {
|
||||
if (number === 0) {
|
||||
return 0;
|
||||
// that is not what sign usually returns
|
||||
// but that is what we need
|
||||
return 1;
|
||||
}
|
||||
if (number > 0) {
|
||||
return 1;
|
||||
|
@@ -31,6 +31,7 @@ export interface TextConfig extends ShapeConfig {
|
||||
verticalAlign?: string;
|
||||
padding?: number;
|
||||
lineHeight?: number;
|
||||
letterSpacing?: number;
|
||||
wrap?: string;
|
||||
ellipsis?: boolean;
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ export interface TransformerConfig extends ContainerConfig {
|
||||
anchorStroke?: string;
|
||||
anchorStrokeWidth?: number;
|
||||
anchorSize?: number;
|
||||
anchorCornerRadius?: number;
|
||||
keepRatio?: boolean;
|
||||
centeredScaling?: boolean;
|
||||
enabledAnchors?: Array<string>;
|
||||
|
Reference in New Issue
Block a user