react-rnd
react-rnd copied to clipboard
Overriding or adding transform property
Hi team I'm using react-rnd version [latest]
My question: is there any way to add css transform of RND component using style property?
Example code:
render() {
const styleRnd = {
border:'2px solid',
willChange: 'transform',
transform: this.data.style.transform,
};
return (
<Rnd style={styleRnd}
default={{
x: 0,
y:0
}}
size={{
width: '100',
height: '100'
}}
>
<div>test</div>
</Rnd>
}
I need this because, I'm trying to add Rotation capabilites to RND component using CSS transform: rotate()
https://www.webpackbin.com/bins/-KuQ4kQj4Os2k9glctKz
Thanks!
@diegoclerici Thanks for your report :) Hmm, It is a difficult issue, transform property is overwritten by react-draggable.I will think about it.
Probably we need to fix react-draggable so that transform will not be overwritten
Any news?
Reproduced project
https://codesandbox.io/s/3qyjyy1v3p
Any news?
+1
Any updates on this? I need to use transform to provide support for rotate.
+1
+1
+1
+1
+1
+1
+1 did anyone found a work around?
+1 Any update on this.
+1 Any update on this?
+1
To override the transform property, you can use the className-prop to set a custom class, and then set the important flag on the transform property.
Example:
<Rnd
className="react-draggable-overwrite"
/>
In a CSS-file:
.react-draggable-overwrite {
transform: translate(0px, 0px) !important;
}
To override the transform property, you can use the className-prop to set a custom class, and then set the important flag on the transform property.
Example:
<Rnd className="react-draggable-overwrite" />In a CSS-file:
.react-draggable-overwrite { transform: translate(0px, 0px) !important; }
Sure but you still need to keep the translate(x, y) position and not overwrite it with zero-values.
@bokuweb Please let us know if there is any update on this.