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

Allow to select bounding box independent from path item #769

Closed
kaelumania opened this issue Sep 4, 2015 · 8 comments
Closed

Allow to select bounding box independent from path item #769

kaelumania opened this issue Sep 4, 2015 · 8 comments

Comments

@kaelumania
Copy link

Is it possible to select only the bounding box and not the path itsself. It seems setting item.bounds.selected = true select all path segments etc. (as also stated in the documentation).

Or what is the best solution to draw a custom selection rectangle? With custom handles etc.

@lehni
Copy link
Member

lehni commented Sep 7, 2015

That sounds like a bug, actually!

@kaelumania
Copy link
Author

@lehni Okay thanks. Do you have any recommendations regarding my second question? Whats the best strategy to draw a custom 'selector' for each item (e.g. for rotating and resizing an item with bigger segment handles)?

@kaelumania
Copy link
Author

@lehni Here is a snippet:

svg = project.importSVG(
        '<svg width="400" height="200" viewBox="0 0 1200 600" xmlns="http://www.w3.org/2000/svg" version="1.1"> ' +
        '<title>Example quad01 - quadratic Bézier commands in path data</title>' +
        '<desc>Picture showing a "Q" a "T" command, along with annotations showing the control points and end points</desc>' +
        '<path id="my_curve" d="M200,300 Q400,50 600,300 T1000,300" fill="none" stroke="green" stroke-width="5" />' +
        '<rect id="my_rect" x="1" y="1" width="1198" height="598" fill="none" stroke="blue" stroke-width="2" />' + 
        '</svg>'
)

svg.bounds.selected = true

@lehni
Copy link
Member

lehni commented Sep 11, 2015

There is paper.settings.handleSize that you can use to control the handle size:

http://paperjs.org/reference/paperscope/#settings

And the possibility to customize selection style was already requested here #433

@kaelumania
Copy link
Author

@lehni Thanks. About the issue setting bound/path selection independently: I had a look at the source code and found the drawHandles and drawSegments methods. Should I investigate further to find the bug? Or have you already found the source and have an idea how to fix it?

@kaelumania
Copy link
Author

I think here is the source of the issue:

owner.setSelected(selected || owner._selectedSegmentState > 0);

I need this feature to only set the bounds of an item (svg item) to be selected. Selecting all segements of an complex SVG item looks just terrible :) My current workaround is to set item._selectChildren = false

@lehni
Copy link
Member

lehni commented Sep 11, 2015

Yes I have a pretty clear picture what's off, but the code needs some changing to separate selection of items from selection of bounds. I haven't had the time yet to look into it next to all the other ongoing issues...

@lehni
Copy link
Member

lehni commented Mar 17, 2016

@kaelumania this required quite a bit of refactoring to implement properly. Please test and let me know how it works for you!

sapics added a commit to sapics/paper.js that referenced this issue May 16, 2016
…election from item and bounds."

This reverts commit f0edcd3.

# Conflicts:
#	src/path/Segment.js
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