Ellipse transformer event....??
See original GitHub issueIf you change the size, it will be greatly enlarged or reduced. Do you have anything to fix?
` import React from ‘react’; import { Ellipse, Circle, Transformer } from ‘react-konva’; import clamp from “clamp”;
const CircleComponent = ({ shapeProps, tool, isSelected, onSelect, onChange, toolboxUse }) => {
const shapeRef = React.useRef();
const trRef = React.useRef();
React.useEffect(() => {
if (tool == "cursor" && isSelected && toolboxUse) {
trRef.current.nodes([shapeRef.current]);
trRef.current.getLayer().batchDraw();
}
}, [isSelected]);
return (
<React.Fragment>
<Ellipse
onClick={onSelect}
onTap={onSelect}
ref={shapeRef}
strokeScaleEnabled={false}
{...shapeProps}
draggable={tool == "cursor" && toolboxUse}
onDragEnd={(e) => {
onChange({
...shapeProps,
x: e.target.x(),
y: e.target.y(),
});
}}
onTransformEnd={(e) => {
const node = shapeRef.current;
let radiusX = Math.floor(node.width() * node.scaleX() / 2);
let radiusY = Math.floor(node.height() * node.scaleY() / 2);
let param = {
fill: shapeProps.fill,
id: shapeProps.id,
key: shapeProps.key,
regId: shapeProps.regId,
scaleX: 1,
scaleY: 1,
stroke: shapeProps.stroke,
strokeWidth: shapeProps.strokeWidth,
tool: shapeProps.tool,
x: node.x(),
y: node.y(),
rotation : node.attrs.rotation,
radiusX : radiusX,
radiusY : radiusY,
width : node.width(),
height : node.height()
};
console.log(param);
onChange(param);
}}
/>
{tool == "cursor" && isSelected && toolboxUse && (
<Transformer
ref={trRef}
centeredScaling={true}
boundBoxFunc={(oldBox, newBox) => {
console.log(oldBox);
console.log(newBox);
// if (newBox.width > 200) {
// return oldBox;
// }
return newBox;
}}
/>
)}
</React.Fragment>
);
};
export default CircleComponent;
`
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
2DEllipseReplacer | FME - Safe Software
Replaces the geometry of the feature with a two-dimensional ellipse whose shape is set by the parameters, values or the values of existing...
Read more >Class: Transformer - Konva
Transformer constructor. Transformer is a special type of group that allow you transform Konva primitives and shapes. Transforming tool is not changing ...
Read more >ECLIPSE - Transformer Monitor | Advanced Power Technologies
The ECLIPSE transformer monitor optimizes transformer efficiency with patented technology that possesses a comprehensive set of features. Learn more today!
Read more >Ellipse® APM Edge Minimize unscheduled downtime and ... - ABB
Over the life of a transformer, the asset will be subject to various conditional and environmental events from the power network.
Read more >Ellipse APM 5.0 User Guide 5.1 - UserManual.wiki
Ellipse APM Supported Assets Ellipse APM contains out of the box models for the following asset types: n Oil filled Transformers n HV...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see the issue.
Do not specify width/height for an ellipse. It is a duplication from
radiusX
andradiusY
. And looks like it produces conflict in attributes settings.Fixed version: https://codesandbox.io/s/sleepy-cloud-7h8lh?file=/src/component/CircleComponent.js
Can you please make a small codesandbox demo?