Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

group.id argument for draw listener #198

Closed
yossidev opened this issue Jan 18, 2016 · 0 comments
Closed

group.id argument for draw listener #198

yossidev opened this issue Jan 18, 2016 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@yossidev
Copy link

In dwv/src/tools/draw.js

this.execute = function () {
       ...
        // callback
        this.onExecute({'type': 'draw-create', 'id': group.id});
    };

The group.id is Kinetic.Factory.addOverloadedGetterSetter.constructor.(anonymous function)

addOverloadedGetterSetter: function(constructor, attr) {
            var capitalizedAttr = Kinetic.Util._capitalize(attr),
                setter = SET + capitalizedAttr,
                getter = GET + capitalizedAttr;

            constructor.prototype[attr] = function() {
                // setting
                if (arguments.length) {
                    this[setter](arguments[0]);
                    return this;
                }
                // getting
                else {
                    return this[getter]();
                }
            };
        },

When I call this function from the listener 'this' is not the group.

Maybe, the code should be like the below

this.execute = function () {
       ...
        // callback
        this.onExecute({'type': 'draw-create', 'id': group.id()});
    };
@ivmartel ivmartel added the bug Something isn't working label Jan 19, 2016
@ivmartel ivmartel added this to the 0.14.0 milestone Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants