react-eyedrop
Advanced tools
Comparing version 5.3.1 to 5.3.2
@@ -75,4 +75,6 @@ "use strict"; | ||
const { target } = e; | ||
if (!target) | ||
return; | ||
const targetCanvas = yield (0, targetToCanvas_1.targetToCanvas)(target); | ||
const rgbColor = (0, getColor_1.getColor)(pickRadius, targetCanvas, e); | ||
const rgbColor = (0, getColor_1.getColor)(targetCanvas, e, pickRadius); | ||
updateColors(rgbColor); | ||
@@ -105,2 +107,9 @@ once && deactivateColorPicking(); | ||
}, [pickingColorFromDocument, exitPickByEscKey]); | ||
useEffect(() => { | ||
return () => { | ||
if (document.body) { | ||
document.body.style.cursor = cursorInactive; | ||
} | ||
}; | ||
}, []); | ||
const shouldColorsPassThrough = colorsPassThrough ? { [colorsPassThrough]: colors } : {}; | ||
@@ -107,0 +116,0 @@ return (React.createElement("div", { style: styles.eyedropperWrapper, className: wrapperClasses }, CustomComponent ? (React.createElement(CustomComponent, Object.assign({ onClick: pickColor }, shouldColorsPassThrough, { customProps: customProps, disabled: buttonDisabled }))) : (React.createElement(React.Fragment, null, |
@@ -1,1 +0,1 @@ | ||
export declare const getColor: (pickRadius: number, targetCanvas: HTMLCanvasElement, e: MouseEvent) => any; | ||
export declare const getColor: (targetCanvas: HTMLCanvasElement, e: MouseEvent, pickRadius?: number) => any; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const calcAverageColor_1 = require("./calcAverageColor"); | ||
const getColor = (pickRadius, targetCanvas, e) => { | ||
const getColor = (targetCanvas, e, pickRadius) => { | ||
const { offsetX, offsetY } = e; | ||
@@ -10,0 +10,0 @@ if (pickRadius === undefined || pickRadius === 0) { |
@@ -40,4 +40,6 @@ "use strict"; | ||
const { target } = e; | ||
if (!target) | ||
return; | ||
const targetCanvas = yield (0, targetToCanvas_1.targetToCanvas)(target); | ||
const rgbColor = (0, getColor_1.getColor)(pickRadius, targetCanvas, e); | ||
const rgbColor = (0, getColor_1.getColor)(targetCanvas, e, pickRadius); | ||
updateColors(rgbColor); | ||
@@ -64,3 +66,3 @@ once && setPickingColorFromDocument(false); | ||
useEffect(() => { | ||
if (document.body) { | ||
if (document.body && (cursorActive && cursorInactive)) { | ||
document.body.style.cursor = pickingColorFromDocument ? cursorActive : cursorInactive; | ||
@@ -67,0 +69,0 @@ } |
{ | ||
"name": "react-eyedrop", | ||
"version": "5.3.1", | ||
"version": "5.3.2", | ||
"description": "A reusable ColorPick EyeDropper written in React & TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
35434
573