Restructure Canvas state class hierarchy#4328
Conversation
johnzhou721
left a comment
There was a problem hiding this comment.
Most of the changes looked pretty mechanical, so I haven't stood here going through every single change; might've missed some typos in the middle.
But two things about changenotes.
freakboy3742
left a comment
There was a problem hiding this comment.
Mechanically, I think the class reorganisation makes sense; my hesitation is around the specific naming. A manager manages.... something. I don't know that it conceptually makes sense that drawing operations happen by way of adding things to a "manager".
My suggestion would be that "DrawingActionManager" is actually a BaseState - and State is a concrete manifestation of BaseState that doesn't actually add any new context. Fill/Stroke etc are then also BaseStates, adding the appropriate calls to make those things happen.
|
Well thanks for helping me cut this PR way down! I've reverted most of the changes made to references to states. I've switched many of them to lower-case, on the basis that "State" is a class, while "state" is the concept embodied by BaseState. I also changed a couple of references to "drawing context managers" to "Canvas context managers", to avoid ambiguity with drawing contexts. |
freakboy3742
left a comment
There was a problem hiding this comment.
👍 This has gone from a lot of churn, to ultimately not very controversial at all - nice work.
Part of #3994
Removes
Stateas the parent class of drawing action context managers, and instead makes it a sibling to them; all of them are now subclasses ofDrawingActionManager.For the most part, I've tried to stick to just "manager" and avoid "context manager" in class and attribute names, because of the inevitable ambiguity with drawing contexts. I've used it in various error messages (and comments) though, so no one will be like "What the heck's a 'manager'?"
In a few places, rather than translate, I've simply removed the reference to context managers. So "Draw a rounded rectangle in the canvas state" becomes "Draw a rounded rectangle."
Original comment here: #4159 (comment)
PR Checklist: