Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const oldCenter = {
x: x + width / 2,
y: y + height / 2,
};
const newCenter = this.getMidDragMatrix().applyToPoint(
oldCenter.x,
oldCenter.y
);
// Logic taken from
// https://github.com/SVG-Edit/svgedit/blob/396cce40ebfde03f7245c682041f63f07f69e3d3/editor/recalculate.js#L790-L800
return Matrix.from(
transform(
inverse(rotateDEG(rotate, newCenter.x, newCenter.y)),
rotateDEG(rotate, oldCenter.x, oldCenter.y),
this.getMidDragMatrix({
rotationOffset: -rotate,
})
)
);
}
transformPoint(x, y) {
return applyToPoint(inverse(this.matrix), { x, y });
}
export default function Miniature(props) {
let {value, onChangeValue, children, position, background, SVGBackground, width: miniatureWidth, height: miniatureHeight} = props;
let {SVGMinX, SVGMinY, SVGWidth, SVGHeight, viewerWidth, viewerHeight} = value;
let ratio = SVGHeight / SVGWidth;
let zoomToFit = ratio >= 1
? miniatureHeight / SVGHeight
: miniatureWidth / SVGWidth;
let [{x: x1, y: y1}, {x: x2, y: y2}] = applyToPoints(inverse(value), [
{x: 0, y: 0},
{x: viewerWidth, y: viewerHeight}
]);
let width, height;
if (value.miniatureOpen) {
width = miniatureWidth;
height = miniatureHeight;
} else {
width = 24;
height = 24;
}
let style = {
position: "absolute",
overflow: "hidden",
export function getSVGPoint(value, viewerX, viewerY) {
var matrix = fromObject(value);
var inverseMatrix = inverse(matrix);
return applyToPoint(inverseMatrix, { x: viewerX, y: viewerY });
}
export function getSVGPoint(value, viewerX, viewerY) {
let matrix = fromObject(value);
let inverseMatrix = inverse(matrix);
return applyToPoint(inverseMatrix, {x: viewerX, y: viewerY});
}