Le 03/07/2014 10:53, Guillaume Larcheveque a écrit :
2014-07-03 10:30 GMT+02:00 Yuriy Tymchuk <yuriy.tymchuk@me.com mailto:yuriy.tymchuk@me.com>:
For me it’s completely fine. Shape is a shape, and then elements can use to show themselves.Now if you have a sale and change it’s color then all the elements show this shape with different color. If you need things with different colors, you need different shapes.
It creates a kind of implicit group that is not really easy to understand and to maintain. If you want to change the color or any other property of a shape on lots of elements, a better way would be to use a group and then ask to this group to change and update all its elements. It's terribly confusing to change a single element and to have a modification on every elements that were created in the same way. In addition those elements will not be updated soon so you will not see that they changed until you update them.
Read:
Lightweight Design Pattern :) A perfectly understandable design decision from Roassal in the context of graphics... just don't forget the side effects.
Now a copy on write design for shapes could be nice (create a derived shape object once you start changing some attributes of an element), as well as a context design (arrange so that some attributes changes such as highlighting are a property of the element and do not require creation of the shape).
Alexandre, I think this is your call :)
Other thing is that it would be nice to have some highlight option, so you don’t need to create 1000 shapes only if you can to be able to highlight individual element.
+1. See above, but remember that even the copy on write design does the creation lazily (only when highlighting, not when deciding to allow possible highlighting).
Thierry