Creates a generic Maze Drawer class#9224
Merged
Merged
Conversation
And refactors BeeItemDrawer and DirtDrawer to extend it. Previously, BeeItemDrawer inherited from DirtDrawer, although DirtDrawer contained a lot of functionality that BeeItemDrawer intentionally discarded. This refactor plus ES6 class implementation makes their shared vs individual functionality a bit cleaner, and will also make it easier to add a new Drawer for the new WIP Collector Level type.
Contributor
Author
|
I would highly recommend reviewing this PR with whitespace ignored |
1 task
Contributor
|
This LGTM. I'm a little surprised this change adds more code than it removes :) but it's a nice refactor. 👍 |
Contributor
|
Looks like some tests depended on something you removed? |
| import Drawer from './drawer'; | ||
| const SQUARE_SIZE = 50; | ||
| let SVG_NS = require('../constants').SVG_NS; | ||
| let cellId = require('./mazeUtils').cellId; |
897aab9 to
4d8d50f
Compare
Contributor
Author
|
PTA(quick)L |
| * @return {number} | ||
| */ | ||
| spriteIndexForDirt_(val) { | ||
| static spriteIndexForDirt_(val) { |
Contributor
There was a problem hiding this comment.
Nice... I think this is the first time I've seen someone use the static keyword in JavaScript.
Contributor
Author
There was a problem hiding this comment.
It's exciting to see it added to the language! JavaScript feels like it's growing up ... 😂
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And refactors BeeItemDrawer and DirtDrawer to extend it.
Previously, BeeItemDrawer inherited from DirtDrawer, although DirtDrawer
contained a lot of functionality that BeeItemDrawer intentionally
discarded. This refactor plus ES6 class implementation makes their
shared vs individual functionality a bit cleaner, and will also make it
easier to add a new Drawer for the new WIP Collector Level type.