Giter Club home page Giter Club logo

Comments (6)

mike-suggitt avatar mike-suggitt commented on June 24, 2024

@atomworks I'm taking a look at this myself right now

from ngimgcrop.

atomworks avatar atomworks commented on June 24, 2024

Excellent. If I can provide any other information just let me know and I'll see what I can do!

from ngimgcrop.

mike-suggitt avatar mike-suggitt commented on June 24, 2024

Ok I think i might have it. I'm not going to do a pull request as I have a slightly mangled / feature diverse repo. HOWEVER, try replacing the following lines at the end of setMaxDimensions in crop-host.js

var center = theArea.getCenterPoint();
theArea.setCenterPoint({x: center.x*ratioNewCurWidth, y: center.y*ratioNewCurHeight});

with

var center = theArea.getCenterPoint();
theArea.setSize({w: theArea.getSize().w * ratioNewCurWidth, h: theArea.getSize().h * ratioNewCurHeight});
theArea.setCenterPoint({x: center.x * ratioNewCurWidth, y: center.y * ratioNewCurHeight});

from ngimgcrop.

mike-suggitt avatar mike-suggitt commented on June 24, 2024

Can I assume from your silence that this worked? :)

from ngimgcrop.

atomworks avatar atomworks commented on June 24, 2024

Hi Mike, apologies!

I'm running a circuit on tasks for this project and haven't got round to checking this yet. I was expecting to have had a chance by now so apologies for not responding!

I'll take a look at it and get back to you today / tomorrow! Thanks for taking a look in to this, much appreciated!

from ngimgcrop.

theBliz avatar theBliz commented on June 24, 2024

+1
got the same issue but in crop-host.js there are not those line of code at the end of setMaxDimensions.
I tried to add the fix you suggest at the end of setMaxDimension but it didn't work.

Edit:
I found out that deleting the code line

elCanvas.prop('width',canvasDims[0]).prop('height',canvasDims[1]).css({'margin-left': -canvasDims[0]/2+'px', 'margin-top': -canvasDims[1]/2+'px'}); var ratioNewCurWidth=ctx.canvas.width/curWidth, ratioNewCurHeight=ctx.canvas.height/curHeight, ratioMin=Math.min(ratioNewCurWidth, ratioNewCurHeight); theArea.setX(theArea.getX()*ratioNewCurWidth); theArea.setY(theArea.getY()*ratioNewCurHeight); theArea.setSize(theArea.getSize()*ratioMin); console.log(theArea.getSize()*ratioMin);

in setMaxDimension, the ngImgCrop plugin works fine.

from ngimgcrop.

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.