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

Integrate selected colors service #310

Merged
merged 14 commits into from
Sep 20, 2015
Merged

Conversation

grosbouddha
Copy link
Collaborator

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.

…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());
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@juliandescottes
Copy link
Collaborator

Thanks for the refactor !

Good to merge after addressing my comments.
(no need for re-review, I think you have the permissions to merge to master ?)

grosbouddha added a commit that referenced this pull request Sep 20, 2015
…Service

Integrate selected colors service
@grosbouddha grosbouddha merged commit d576c56 into master Sep 20, 2015
@grosbouddha grosbouddha deleted the Integrate-SelectedColorsService branch September 20, 2015 00:32
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.

None yet

2 participants