react-konva-utils
Advanced tools
Comparing version 0.1.7 to 0.2.0
import Konva from 'konva'; | ||
import { PropsWithChildren } from 'react'; | ||
declare type TransformAttrs = { | ||
x: number; | ||
y: number; | ||
scaleX: number; | ||
scaleY: number; | ||
rotation: number; | ||
skewX: number; | ||
skewY: number; | ||
}; | ||
declare type Props = PropsWithChildren<{ | ||
@@ -7,4 +16,5 @@ groupProps?: Konva.ContainerConfig; | ||
transform?: boolean; | ||
transformFunc?: (attrs: TransformAttrs) => TransformAttrs; | ||
}>; | ||
export declare const Html: ({ children, groupProps, divProps, transform }: Props) => JSX.Element; | ||
export declare const Html: ({ children, groupProps, divProps, transform, transformFunc, }: Props) => JSX.Element; | ||
export {}; |
@@ -20,3 +20,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
export const Html = ({ children, groupProps, divProps, transform }) => { | ||
export const Html = ({ children, groupProps, divProps, transform, transformFunc, }) => { | ||
const groupRef = React.useRef(null); | ||
@@ -32,3 +32,6 @@ const container = React.useRef(); | ||
const tr = groupRef.current.getAbsoluteTransform(); | ||
const attrs = tr.decompose(); | ||
let attrs = tr.decompose(); | ||
if (transformFunc) { | ||
attrs = transformFunc(attrs); | ||
} | ||
div.style.position = 'absolute'; | ||
@@ -35,0 +38,0 @@ div.style.zIndex = '10'; |
{ | ||
"name": "react-konva-utils", | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"description": "Useful components and hooks for react-konva", | ||
@@ -27,8 +27,2 @@ "author": "Anton Lavrenov", | ||
], | ||
"size-limit": [ | ||
{ | ||
"path": "./lib/polotno-app.js", | ||
"limit": "395 KB" | ||
} | ||
], | ||
"devDependencies": { | ||
@@ -35,0 +29,0 @@ "@babel/core": "^7.13.14", |
@@ -12,2 +12,3 @@ # Useful components and hooks for [react-konva](https://github.com/konvajs/react-konva/) apps. | ||
transform // should we apply position transform automatically to DOM container, default is true | ||
transformFunc={(transformAttrs) => newAttrs} // function to overwrite transformation attributes, not used if transform = false, default is undefined | ||
groupProps={{}} // additional properties to the group wrapper, useful for some position offset | ||
@@ -14,0 +15,0 @@ divProps={{}} // additional props for wrapped div elements, useful for styles |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11353
224
36