-
Notifications
You must be signed in to change notification settings - Fork 765
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
Integrate selected colors service #310
Conversation
…tController - update selectedColorsService getColors array API to explicit getPrimary/getSecondary - update drawing test helper as well
…tController - update selectedColorsService getColors array API to explicit getPrimary/getSecondary - update drawing test helper as well
… into Integrate-SelectedColorsService Conflicts: src/js/controller/DrawingController.js src/js/tools/drawing/DitheringTool.js
var strokePoints = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row); | ||
for (var i = 0 ; i < strokePoints.length ; i++) { | ||
// Change model: | ||
targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, color); | ||
targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, this.getToolColor()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should use "color" instead of getToolColor().
The logic to swap TRANSPARENT_COLOR for the SELECTION_TRANSPARENT_COLOR is done in the ShapeTool here. It allows to preview your rectangle if you are using the transparent color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thanks for the refactor ! Good to merge after addressing my comments. |
…Service Integrate selected colors service
The goal of this list of changes is to remove the color arguments from all BaseTool/BaseSelect interfaces and rely on centralized/shared services to provide colors that tools should use.
The color that a tool should use is based on the current primary/secondary colors and if the right/left button of the mouse is used.
SelectedColorsService provides the primary/secondary colors.
The new service MouseStateService provides the mouse button state (and encapsulate properly the mousemove mouse button type bug in FF/IE).
Each tool can use these two services in the getToolColor base method to know which color to use, and the color argument can be removed from the applyToolAt/releaseToolAt/... methods.