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
ZOOM_DISTANCE into a const
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -38,6 +38,9 @@ const MAX_ZOOM = 300;
|
|||||||
const ZOOM_STEP = 10;
|
const ZOOM_STEP = 10;
|
||||||
// This is used for mouse wheel events
|
// This is used for mouse wheel events
|
||||||
const ZOOM_COEFFICIENT = 10;
|
const ZOOM_COEFFICIENT = 10;
|
||||||
|
// If we have moved only this much we can zoom
|
||||||
|
const ZOOM_DISTANCE = 10;
|
||||||
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
src: string, // the source of the image being displayed
|
src: string, // the source of the image being displayed
|
||||||
@@ -234,8 +237,8 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||||||
// Zoom out if we haven't moved much
|
// Zoom out if we haven't moved much
|
||||||
if (
|
if (
|
||||||
this.state.moving === true &&
|
this.state.moving === true &&
|
||||||
Math.abs(this.state.translationX - this.previousX) < 10 &&
|
Math.abs(this.state.translationX - this.previousX) < ZOOM_DISTANCE &&
|
||||||
Math.abs(this.state.translationY - this.previousY) < 10
|
Math.abs(this.state.translationY - this.previousY) < ZOOM_DISTANCE
|
||||||
) {
|
) {
|
||||||
this.setState({
|
this.setState({
|
||||||
zoom: MIN_ZOOM,
|
zoom: MIN_ZOOM,
|
||||||
|
|||||||
Reference in New Issue
Block a user