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

fabric.PatternBrush difference between drawing mode and resulting fabric.Object #851

Closed
Kienz opened this issue Sep 16, 2013 · 8 comments · Fixed by #3112
Closed

fabric.PatternBrush difference between drawing mode and resulting fabric.Object #851

Kienz opened this issue Sep 16, 2013 · 8 comments · Fixed by #3112
Assignees
Labels
Milestone

Comments

@Kienz
Copy link
Collaborator

Kienz commented Sep 16, 2013

If you draw a fabric.PatternBrush the result during the drawing mode is different to to the created fabric.Path.
You can see this in kitchensink demo - draw one dot (before testing update fabric - see ba2a0e6).

In drawing mode:
image

After drawing mode (fabric.Path):
image

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@kangax
Copy link
Member

kangax commented Sep 16, 2013

I think I noticed this before as well. Will investigate.

@Kienz
Copy link
Collaborator Author

Kienz commented Nov 6, 2013

@kangax Since changing originX/originY to left/top all brushes positioned wrong after mouseUp. You can see it in kitchensink demo.

@kangax
Copy link
Member

kangax commented Nov 6, 2013

Great....

@kangax
Copy link
Member

kangax commented Nov 27, 2013

Spent couple hours trying to figure this out but without success for now... asked related question on SO. Moving this out of 1.4 for now.

@pstolz
Copy link

pstolz commented Jan 30, 2014

Are there news for this bug?

@kangax
Copy link
Member

kangax commented Jan 30, 2014

Not from me

On Thu, Jan 30, 2014 at 5:53 AM, pstolz notifications@github.com wrote:

Are there news for this bug?

Reply to this email directly or view it on GitHubhttps://github.com//issues/851#issuecomment-33677538
.

@asturur asturur self-assigned this Jun 8, 2015
@asturur
Copy link
Member

asturur commented Jun 8, 2015

it think that in renderStroke we are missing the counterpart of this part of renderFill function:

if (this.fill.toLive) {
        ctx.translate(
          -this.width / 2 + this.fill.offsetX || 0,
          -this.height / 2 + this.fill.offsetY || 0);
      }
}

@asturur
Copy link
Member

asturur commented Jun 9, 2015

Ok i found the problem:
The pattern brush has the pattern always aligned to 0,0.
So when we draw it the pattern is not translated.

When the object is actually created, we always do some translation of canvas to place it properly.
I tried to do a ctx.translate for widht/2 and left in all possible combination and permutation, but i did not get any good result.

I think anyway this is the problem.

I was thinking about do the correct translation just in the path _render function, because this problem is tied mainly to drawing mode that produces path, is not a general rule of our rendering pipeline.

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

Successfully merging a pull request may close this issue.

4 participants