mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 00:41:31 +03:00
Fixed translation issue while the image is rotated
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
6758734593
commit
18de342fa1
1 changed files with 7 additions and 3 deletions
|
@ -242,11 +242,15 @@ export default class ImageView extends React.Component {
|
|||
const zoomPercentage = this.state.zoom/100;
|
||||
const translatePixelsX = this.state.translationX + "px";
|
||||
const translatePixelsY = this.state.translationY + "px";
|
||||
/* The order of the values is important!
|
||||
* First, we translate and only then we rotate, otherwise
|
||||
* we would apply the translation to an already rotated
|
||||
* image causing it translate in the wrong direction. */
|
||||
const style = {
|
||||
transform: `rotate(${rotationDegrees})
|
||||
transform: `translateX(${translatePixelsX})
|
||||
translateY(${translatePixelsY})
|
||||
scale(${zoomPercentage})
|
||||
translateX(${translatePixelsX})
|
||||
translateY(${translatePixelsY})`,
|
||||
rotate(${rotationDegrees})`,
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue