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 and Path should have 'position' prop #15

Open
kota65535 opened this issue Feb 24, 2018 · 2 comments
Open

Group and Path should have 'position' prop #15

kota65535 opened this issue Feb 24, 2018 · 2 comments

Comments

@kota65535
Copy link
Contributor

kota65535 commented Feb 24, 2018

I found some issues for moving position of Group and Path.

Problem of center and point prop on Group and Path component

both prop perfectly work for shaped paths, like Circle, Rectangle ...etc.
On the other hand, Path and Group does not reflect its initial position by these props.
For example, this below does not set its center position to [100, 100].

        <Path
          segments={[[20, 20], [80, 80], [140, 20]]}
          center={[100,100]}
          fillColor={'black'}
        />

This also does not work.

        <Path
          segments={[[20, 20], [80, 80], [140, 20]]}
          point={[100,100]}
          fillColor={'black'}
        />

introducing position prop

position prop works for not only shaped paths but also all Item based objects, Path, Group. Layers ...etc. But currently changing these props does not move its actual position. It would be better if this prop is available, like below.

        <Path
          segments={[[20, 20], [80, 80], [140, 20]]}
          position={new Point(100,100)}
          fillColor={'black'}
        />
@HriBB
Copy link
Collaborator

HriBB commented Feb 25, 2018

Hey @kota65535. It's been some time, since I last worked on this library, but I think that vanilla PaperJS does not support changing center/point props on Path or Group. As you have already figured out, it works for Circle for example.

I think something like position prop would be perfect for this use case. I was trying to keep the custom props down to the minimum, but for some cases it just makes sense. You can make a PR if you wish.

@kota65535
Copy link
Contributor Author

Hi @HriBB, I already have some working codes and test cases that go along with #14.
I will brush up them and make PR this week.

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