You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Add comment about modulo operator
Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
@@ -188,6 +188,8 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
// relative to the center of the image, accounting for rotation.
|
// relative to the center of the image, accounting for rotation.
|
||||||
let offsetX;
|
let offsetX;
|
||||||
let offsetY;
|
let offsetY;
|
||||||
|
// The modulo operator can return negative values for some
|
||||||
|
// rotations, so we have to do some extra work to normalize it
|
||||||
switch (((this.state.rotation % 360) + 360) % 360) {
|
switch (((this.state.rotation % 360) + 360) % 360) {
|
||||||
case 0:
|
case 0:
|
||||||
offsetX = this.image.current.clientWidth / 2 - anchorX;
|
offsetX = this.image.current.clientWidth / 2 - anchorX;
|
||||||
|
|||||||
Reference in New Issue
Block a user