How does scale work ?

Open
#488 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, react
Domain
frontend

Research direction

Begin at the Draggable component's scale prop and the supplied position-saving handler; compare behavior at differing image resolutions. Done means the scale behavior and expected coordinate conversion are clarified or corrected, but the issue names no file or test to run.

Written by the indexing model from the issue text.

Description

I want to place an moveable element on top of an image. When I open the image on another Browser with a different resolution the position of the moveable element does not change according to the scale of the image.

It seems like the scale property is the right way to handle this. But unfortunately nothing changes if I add the scale factor (For example 0.4).

<Draggable bounds="parent" scale={this.getPane()["offsetWidth"] / (this.getPane()["naturalWidth"])} defaultPosition={pos} offsetParent={document.getElementById("annotationcontainer")} onStop={(e,data) => { saveToDatabase({ x: data.x, y: data.y, }) }}>

Dominant language
JavaScript
Stars
9.3k
Forks
1k
Avg merge
3d 8h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-grid-layout/react-draggable

All issues in react-grid-layout/react-draggable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.