X Tutup
Skip to content

fix small error in poly_editor example#7354

Merged
tacaswell merged 2 commits intomatplotlib:masterfrom
wsilva32:fix-poly-editor-example
Oct 27, 2016
Merged

fix small error in poly_editor example#7354
tacaswell merged 2 commits intomatplotlib:masterfrom
wsilva32:fix-poly-editor-example

Conversation

@wsilva32
Copy link
Copy Markdown

  • if vertex 0 is grabbed, the last point of the poly should be updated as well

If you grab the 0 vertex, the last vertex is left behind:

screen shot 2016-10-26 at 9 40 34 am

if you grab it, it looks like like a separate line segment:

screen shot 2016-10-26 at 9 40 46 am

after the fix:

screen shot 2016-10-26 at 9 39 57 am

* if vertex 0 is grabbed, the last point of the poly should be updated as well
@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Oct 26, 2016

Is it ever possible to grab the last point (and thus require the opposite fix)?

@wsilva32
Copy link
Copy Markdown
Author

@QuLogic good point. I have never run into that issue myself as it seems it always renders the zeroth vertex directly over the last vertex. But it couldn't hurt to handle that just in case.

…as they overlap

* this case is likely to not occur since it seems that the first vertex handle is rendered over the last vertex handle
self.poly.xy[self._ind] = x, y
if self._ind == 0:
self.poly.xy[-1] = x, y
elif self._ind == len(self.poly.xy) - 1:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make senses to check if if self._ind == -1?

I wouldn't think that it would ever come up, but I'm not good with the interactive stuff.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible.

@tacaswell tacaswell merged commit e794622 into matplotlib:master Oct 27, 2016
@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Oct 27, 2016
tacaswell added a commit that referenced this pull request Oct 27, 2016
DOC: fix small error in poly_editor example
@tacaswell
Copy link
Copy Markdown
Member

backported to v2.x as b191f85

@wsilva32 Thanks! I think this is your first contribution to mpl 🎉. Hopefully we will hear from you again 😄 .

@tacaswell
Copy link
Copy Markdown
Member

Once CI finishes on the master branch, these changes will show up at http://matplotlib.org/devdocs/examples/event_handling/poly_editor.html

@wsilva32
Copy link
Copy Markdown
Author

@tacaswell It is indeed! Thank you for the welcome and for the hard work you're all putting into matplotlib, it's a great tool.

@wsilva32 wsilva32 deleted the fix-poly-editor-example branch October 27, 2016 15:15
@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Dec 7, 2016
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

Successfully merging this pull request may close these issues.

4 participants

X Tutup