feat: add screenshot functionality to export canvas layout as a PNG image
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { useRef } from 'react';
|
||||
|
||||
import { Rect, Group, Transformer } from 'react-konva';
|
||||
|
||||
export function Tile({ id, initialX, initialY, scale, meterWidth = 1.6, meterHeight = 1.6, color = "rgba(16, 185, 129, 0.6)", stroke = "#10b981", isSelected, onSelect, type, rotation = 0, onChange }) {
|
||||
export function Tile({ initialX, initialY, scale, meterWidth = 1.6, meterHeight = 1.6, color = "rgba(16, 185, 129, 0.6)", stroke = "#10b981", isSelected, onSelect, type, rotation = 0, onChange }) {
|
||||
const shapeRef = useRef();
|
||||
const trRef = useRef();
|
||||
const pixelWidth = meterWidth * scale;
|
||||
@@ -54,7 +55,7 @@ export function Tile({ id, initialX, initialY, scale, meterWidth = 1.6, meterHei
|
||||
y: e.target.y()
|
||||
});
|
||||
}}
|
||||
onTransformEnd={(e) => {
|
||||
onTransformEnd={() => {
|
||||
const node = shapeRef.current;
|
||||
node.scaleX(1);
|
||||
node.scaleY(1);
|
||||
|
||||
Reference in New Issue
Block a user