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

transformsEnabled = 'position' bug v5.0.0 #746

Closed
in-form opened this issue Jan 15, 2014 · 2 comments
Closed

transformsEnabled = 'position' bug v5.0.0 #746

in-form opened this issue Jan 15, 2014 · 2 comments
Assignees

Comments

@in-form
Copy link

in-form commented Jan 15, 2014

Shape position becomes wrong, when shape has transformsEnabled: 'position' option and its parent obj has any transform.

One of solutions is to use shape AbsolutePosition (not shape Position):

    _applyTransform: function(shape) {
        var transformsEnabled = shape.getTransformsEnabled(),
            m, pos;

        if (transformsEnabled === 'all') {
            m = shape.getAbsoluteTransform().getMatrix();
            this.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
        }
        else if (transformsEnabled === 'position') {
            // best performance for position only transforms
            //this.translate(shape.getX(), shape.getY());
            pos = shape.getAbsolutePosition();
            this.translate(pos.x, pos.y);
        }  
    }
@ericdrowell
Copy link
Owner

agreed - this is something that's not fully quite worked out yet. The idea is to have a transform option that ignores parent transforms for performance reasons. I may need to introduce another option like:

shape.ignoreParentTransforms();

or something. Stay tuned on that one.

@ghost ghost assigned ericdrowell Jan 15, 2014
@ericdrowell
Copy link
Owner

update on this thread - the transformsEnabled property is now deprecated. In v5.0.0, I was moving into a direction where devs have to configure lots of individual properties to tweak performance. This doesn't scale. In v5.1.0, you can now use fast layers, which render about 2x faster than normal layers. All of the performance tweaks are done automatically. You can create a fast layer like this:

var layer = new Kinetic.FastLayer();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants