Skip to content

How to have the same +/- scaling step range using useControls (ZoomIn and ZoomOut) ? #532

@BloodLine888

Description

@BloodLine888

I am using the TransformWrapper component with the following setup:

<TransformWrapper
  smooth={false}
  initialScale={1}
  minScale={0.1}
  maxScale={10}
  panning={{ disabled: false, activationKeys: ['Shift'] }}
  wheel={{ disabled: true }}
  pinch={{ disabled: true }}
  doubleClick={{ disabled: true }}
>
  ...
</TransformWrapper>

Additionally, I am using hook useControls() to manage transformations:

const { zoomIn, zoomOut, resetTransform } = useControls();

Issue: I want to implement zoom in and zoom out functionality using useControls() for +/- scaling, but I am not sure how to do the same +/- same scaling step range,

if default scale is 1.00, then:
expected: e.g. case 1 on [+] click have 1.1, 1.2, 1.3 and case 2 on [-] click 0.9, 0.8, 0.7
current behaviour: case 1 on [+] click have 1.1, 1.2, 1.3 and case 2 on [-] click 0.5, 0.1

I don't get, how to have same step for [-] as for [+]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions