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

Shadow offset make path disappear #5031

Closed
liajoy opened this issue Jun 8, 2018 · 2 comments
Closed

Shadow offset make path disappear #5031

liajoy opened this issue Jun 8, 2018 · 2 comments

Comments

@liajoy
Copy link

liajoy commented Jun 8, 2018

Version

2.3.1

Test Case

https://jsfiddle.net/msxr0wku/

Steps to reproduce

  1. let a image and a path in the group.
  2. clone image and set shadow offset
  3. click to trigger render
  4. path disappear

Expected Behavior

Actual Behavior

The version 2.3.0 not fix #5016 will make the path whole disappear.
I update to 2.3.2 will make the path partial disappear when i custom a path class like this:
` const Path = fabric.util.createClass(fabric.Path, {
_setPositionDimensions: function(options) {
const calcDim = this._parseDimensions();

        this.width = calcDim.width;
        this.height = calcDim.height;
        if(typeof options.left === 'undefined') {
            this.left = calcDim.left;
        }
        if(typeof options.top === 'undefined') {
            this.top = calcDim.top;
        }
        this.pathOffset = this.pathOffset || {
            x: this.width / 2, 
            y: this.height / 2 
        };
    }
});

`
The pathOffset was modified from this.width /2 + calcDim.let

@asturur
Copy link
Member

asturur commented Jun 8, 2018

https://jsfiddle.net/msxr0wku/1/

Unsure if this is bette, i m waiting for fabic 2.3.2 to be published

@asturur
Copy link
Member

asturur commented Jun 8, 2018

Yes the fix for 2.3.2 conver this case too, and this is definitely how you should handle it. If you are adding an object to a group, you should declare it as dirty.

@asturur asturur closed this as completed Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants