react-rnd icon indicating copy to clipboard operation
react-rnd copied to clipboard

Overriding or adding transform property

Open ghost opened this issue 8 years ago • 20 comments

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!

ghost avatar Sep 19 '17 17:09 ghost

@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

bokuweb avatar Sep 19 '17 23:09 bokuweb

Any news?

koutsenko avatar Jan 17 '18 12:01 koutsenko

Reproduced project

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

linux019 avatar Jul 31 '18 09:07 linux019

Any news?

Aquarius-Sally avatar Aug 23 '18 07:08 Aquarius-Sally

+1

Aquarius-Sally avatar Aug 23 '18 07:08 Aquarius-Sally

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

dholakiyaankit avatar Aug 27 '18 10:08 dholakiyaankit

+1

makis-spy avatar Dec 24 '18 15:12 makis-spy

+1

Hello-Tan avatar Feb 13 '19 09:02 Hello-Tan

+1

LisaKr avatar Sep 02 '19 09:09 LisaKr

+1

kele5240 avatar Nov 18 '19 07:11 kele5240

+1

aktn avatar Jul 14 '20 05:07 aktn

+1

olihou avatar Nov 09 '21 11:11 olihou

+1 did anyone found a work around?

Muhammad-Hammad avatar Apr 20 '22 18:04 Muhammad-Hammad

+1 Any update on this.

vishwalogicwind avatar Jan 11 '23 08:01 vishwalogicwind

+1 Any update on this?

egemenzeytinci avatar Apr 21 '23 09:04 egemenzeytinci

+1

EzioAuditoly avatar Apr 26 '23 07:04 EzioAuditoly

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;
}

hdale94 avatar Aug 09 '23 11:08 hdale94

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.

LorenzoElenkov avatar Nov 26 '23 17:11 LorenzoElenkov

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

Liri-s29 avatar May 05 '24 17:05 Liri-s29