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 update of drawing items #17

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open

Conversation

slvrfn
Copy link
Contributor

@slvrfn slvrfn commented Nov 5, 2018

A user can now have access to the drawing items, and can provide a short list of items that need to be re-calculated. Intended to be used to replace shapes in-place in the items list.

One example is re-coloring only certain drawing items, all items do not need to be re-added/re-calculated.

Moved transformColor to a static context that can be used outside the library when the user is creating items.

slvrfn added 26 commits October 16, 2018 07:58
if an item is ignored, it still goes through sorting. If the item is removed all together, don't need to worry about if the item is drawn or not later in processing
removed bug with calculating twice
… Intended to be used to replace shapes in-place in the items list.

One example is re-coloring only certain drawing items, all items do not need to be re-added/re-calculated
}

//allow user to recalculate only certain items
public void updateItems(List<Item> items, boolean cull, boolean boundsCheck) {
Copy link
Owner

Choose a reason for hiding this comment

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

Aren't the interception checks for the none updated items missing when you update an item that is behind an none updated one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The user would be using this method to directly manipulate the items list returned from getCurrentItems(). I will add a comment that they are taking potentially dangerous actions when they use this method (manipulating an item that is covered by another item), but it is still a useful method to have.

In my own implementation, I get the current items List lis = getCurrentItems() and find references to some Shape s I care about. I then create new Item into List modItems and use updateItems(modItems, true, true) to perform all of the path calculations with culling and bounds detection which removes the bad faces from the provided list. I then directly remove/replace the items updateItemsList(lis, modItems)

@FabianTerhorst
Copy link
Owner

Im going to merge #16 first. Do you want to take a look to see how much the performance improved?Mostly just the amount of allocations is reduced. isPointInPoly is now the slowest calculation when having sort activated.

@slvrfn
Copy link
Contributor Author

slvrfn commented Nov 5, 2018

I definitely believe that about isPointInPoly. There can be a whole lot of edges to check when drawing. Do you have any ideas to improve that method?

I'll definitely take a look at the other performance improvements!

@slvrfn
Copy link
Contributor Author

slvrfn commented Nov 29, 2018

I have added some commits which include the ability to convert to/from Isometric and View coordinate systems.

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.

2 participants