Code Monkey home page Code Monkey logo

Comments (7)

sekoyo avatar sekoyo commented on June 6, 2024

Hi @yury-dymov, I'm having trouble replicating this. What are you passing in initialValue? Your code would be a little simpler/more efficient if it was attaching the crop state to this.state.crop (no need for destructuring then). Also unless you need to update the state each pixel(ish) change as the crop is being dragged it's usually ok to just update the state in onCropComplete.

My guess is that when they are clicking in the next box, a parent component is being re-rendered/setting some prop, and that is causing that component to re-render with some different values - but then it's strange that you can't adjust the crop afterwards - can you also not drag it? Maybe put debugger; statement in the render to see if it's being re-rendered when you click into the next input and see what values are being passed through. Let me know how it goes!

from react-image-crop.

yury-dymov avatar yury-dymov commented on June 6, 2024

@dominictobias, thank you for response.

I figured out the following:

  1. I uploaded 200x400 image (it should be not a square image)
  2. My initialValue is {x: 0, y: 0, width: 100, height: 100, aspect: 1}
    3a) If I change initialValue to {...,width:30, height:30, ...} everything works fine.
    3b) If I change initialValue to {...,width:90, height:90, ...} everything works fine but aspect is broken after performing steps mentioned in the initial message.

In my workflow I would like to have initial square selection with starting point at (0, 0) and side length of min(image_width, image_height).

Update: if I pass only height:100 or width:100, than the issue occurs if longer side was sent and not occurs otherwise

from react-image-crop.

sekoyo avatar sekoyo commented on June 6, 2024

Thanks for the extra details - interesting, sounds like a bug to me I'll take a look

from react-image-crop.

sekoyo avatar sekoyo commented on June 6, 2024

I fixed at least one of the issues - are you still having issues when upgrading to 1.0.0-rc2?

from react-image-crop.

sekoyo avatar sekoyo commented on June 6, 2024

P.S. There are some gotchas when specifying both the width and height with a fixed aspect as this is using percentages - for example 90% & 90% on an image that isn't square would mean that the crop couldn't be square so it has to adjust one of the values. Actually I noticed that at the moment it's adjusting both of them so I need to look into that.

from react-image-crop.

yury-dymov avatar yury-dymov commented on June 6, 2024

@dominictobias for my case both issues are resolved. Thank you!

from react-image-crop.

sekoyo avatar sekoyo commented on June 6, 2024

Ah great!

On Monday, 25 April 2016, Yury Dymov [email protected] wrote:

@dominictobias https://github.com/DominicTobias for my case both issues
are resolved. Thank you!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#31 (comment)

from react-image-crop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.