bokuweb / react-rnd

🖱 A resizable and draggable component for React.
https://bokuweb.github.io/react-rnd/stories
MIT License
3.91k stars 325 forks source link

Overriding or adding transform property #185

Open ghost opened 7 years ago

ghost commented 7 years ago

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!

bokuweb commented 7 years ago

@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

koutsenko commented 6 years ago

Any news?

linux019 commented 6 years ago

Reproduced project

https://codesandbox.io/s/3qyjyy1v3p

Aquarius-Sally commented 6 years ago

Any news?

Aquarius-Sally commented 6 years ago

+1

dholakiyaankit commented 6 years ago

Any updates on this? I need to use transform to provide support for rotate.

makis-spy commented 5 years ago

+1

Hello-Tan commented 5 years ago

+1

LisaKr commented 5 years ago

+1

kele5240 commented 4 years ago

+1

aktn commented 4 years ago

+1

olihou commented 2 years ago

+1

Muhammad-Hammad commented 2 years ago

+1 did anyone found a work around?

vishwalogicwind commented 1 year ago

+1 Any update on this.

egemenzeytinci commented 1 year ago

+1 Any update on this?

EzioAuditoly commented 1 year ago

+1

hdale94 commented 1 year ago

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;
}
LorenzoElenkov commented 10 months ago

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.

Liri-s29 commented 5 months ago

@bokuweb Please let us know if there is any update on this.