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

globalCompositeOperation source-atop doesn't work #26

Open
rivdiv opened this issue Jan 12, 2016 · 4 comments
Open

globalCompositeOperation source-atop doesn't work #26

rivdiv opened this issue Jan 12, 2016 · 4 comments
Labels

Comments

@rivdiv
Copy link

rivdiv commented Jan 12, 2016

For regular text objects, the globalCompositeOperation = source-atop works to prevent the text from going outside the canvas background shape.

For curved text objects, that property doesn't do anything.

See fiddle: https://jsfiddle.net/rivdiv/k4963a9q/2/ (click both buttons)

@EffEPi EffEPi added the bug label May 16, 2016
@Ivangelion
Copy link

Ivangelion commented Jan 18, 2017

Is this bug solved? I also had this problem. Any help would be greatly appreciated.

@rivdiv
Copy link
Author

rivdiv commented Jan 18, 2017

@Ivangelion I ended up using SVG instead of an image to achieve my goal.

    fabric.loadSVGFromURL(svgURL, function (objects, options) {
        var shape = fabric.util.groupSVGElements(objects, options);

        canvas.clipTo = function (ctx) {
            shape.render(ctx);
        };
        canvas.renderAll();
    });

@taifok
Copy link

taifok commented Oct 16, 2017

globalCompositeOperation source-atop has to be applied on every object in the group of the curvedText

curvedTextObject.letters._objects.forEach((object) => {
  object.globalCompositeOperation = 'source-atop';
})

see modified fiddle: https://jsfiddle.net/k4963a9q/11/

@EffEPi
Copy link
Owner

EffEPi commented Oct 18, 2017 via email

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

No branches or pull requests

4 participants