Coder Social home page Coder Social logo

Comments (4)

fengyuanchen avatar fengyuanchen commented on May 3, 2024

It's not good to add image info here. If you realy need the image info, maybe i can add a new method named "getImgInfo" to do this.

from cropper.

jsguy avatar jsguy commented on May 3, 2024

It seems ok to have it as part of the data passed into the "done" function as it is static and related to the other info that comes through.

If you really wanted to, you could add a "getImgInfo" method to the cropper, but then you'd need to access a reference to the cropper instance inside the "done" function, which doesn't quite seem right.
Unless perhaps if you add it as part of the data? ie:

data = {
    x1: dragger.left,
    y1: dragger.top,
    x2: dragger.left + dragger.width,
    y2: dragger.top + dragger.height,
    height: dragger.height,
    width: dragger.width,
    image: this.getImgInfo()
};

That way you could still get to it via data.image, yet it is not exposing the image object directly, if that was your concern?

What do you reckon?

from cropper.

jsguy avatar jsguy commented on May 3, 2024

I see you've added the "getImgInfo" function, however it is private and not called anywhere - are you able to update the getData function to include it, ie:

    getData: function() {
        var dragger = this.dragger,
            data = {};

        if (this.active) {
            data = this.transformData({
                x1: dragger.left,
                y1: dragger.top,
                width: dragger.width,
                height: dragger.height,
                x2: dragger.left + dragger.width,
                y2: dragger.top + dragger.height
            }, "get");
        }

        data.image = this.getImgInfo();

        return data;
    },

Or I can re-fork and add that line if you like? probably easier to just have you add it :)

from cropper.

fengyuanchen avatar fengyuanchen commented on May 3, 2024

Sorry, I just saw this comment..
The result data is dynamic, but the image information is static and not so useful. As this reason, I can't put them together.

from cropper.

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.