@@ -8,7 +8,7 @@ import Dropdown from '../dropdown/dropdown.jsx';
88import MediaQuery from 'react-responsive' ;
99import layout from '../../lib/layout-constants' ;
1010
11- import { changeBrushSize , changeSimplifySize } from '../../reducers/brush-mode' ;
11+ import { changeBrushSize , changeSimplifySize , setBrushType } from '../../reducers/brush-mode' ;
1212import { changeBrushSize as changeEraserSize , changeSimplifySize as changeEraserSimplifySize } from '../../reducers/eraser-mode' ;
1313import { changeSimplifySize as changePenSimplifySize } from '../../reducers/pen-mode' ;
1414import { changeRoundedRectCornerSize } from '../../reducers/rounded-rect-mode' ;
@@ -26,6 +26,8 @@ import Label from '../forms/label.jsx';
2626import { defineMessages , injectIntl , intlShape } from 'react-intl' ;
2727import Input from '../forms/input.jsx' ;
2828import InputGroup from '../input-group/input-group.jsx' ;
29+ import ButtonGroup from '../button-group/button-group.jsx' ;
30+ import Button from '../button/button.jsx' ;
2931import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx' ;
3032import Modes from '../../lib/modes' ;
3133import Formats , { isBitmap , isVector } from '../../lib/format' ;
@@ -96,6 +98,16 @@ const ModeToolsComponent = props => {
9698 description : 'Label for the eraser smoothing input, higher numbers control how much the drawn line will be corrected' ,
9799 id : 'paint.modeTools.eraserSimplify'
98100 } ,
101+ brushCircle : {
102+ defaultMessage : 'Circle Brush' ,
103+ description : 'Label for the circle brush shape' ,
104+ id : 'paint.modeTools.circleSquare'
105+ } ,
106+ brushSquare : {
107+ defaultMessage : 'Square Brush' ,
108+ description : 'Label for the square brush shape' ,
109+ id : 'paint.modeTools.brushSquare'
110+ } ,
99111 roundedCornerSize : {
100112 defaultMessage : 'Rounded corner size' ,
101113 description : 'Label for the Rounded corner size input' ,
@@ -215,7 +227,7 @@ const ModeToolsComponent = props => {
215227 />
216228
217229 { hasSimplifyOption && (
218- < Label text = { props . intl . formatMessage ( messages . brushSimplify ) } >
230+ < Label text = { props . intl . formatMessage ( messages . brushSimplify ) } style = { { marginLeft : 'calc(2 * .25rem)' } } >
219231 < LiveInput
220232 range
221233 small
@@ -227,6 +239,40 @@ const ModeToolsComponent = props => {
227239 />
228240 </ Label >
229241 ) }
242+
243+ { /* TODO replace this with a dropdown when we add more brush shapes */ }
244+ { hasSimplifyOption && (
245+ < InputGroup >
246+ < ButtonGroup >
247+ < Button
248+ className = {
249+ classNames ( styles . buttonGroupButton )
250+ }
251+ onClick = { ( ) => props . onBrushChange ( "CIRCLE" ) }
252+ >
253+ < img
254+ alt = { props . intl . formatMessage ( messages . brushCircle ) }
255+ className = { styles . buttonGroupButtonIcon }
256+ draggable = { false }
257+ src = { "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjMDBjM2ZmIiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIxMDAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuNSAyLjUpIi8+PC9zdmc+" }
258+ />
259+ </ Button >
260+ < Button
261+ className = {
262+ classNames ( styles . buttonGroupButton )
263+ }
264+ onClick = { ( ) => props . onBrushChange ( "SQUARE" ) }
265+ >
266+ < img
267+ alt = { props . intl . formatMessage ( messages . brushSquare ) }
268+ className = { styles . buttonGroupButtonIcon }
269+ draggable = { false }
270+ src = { "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjMDBjM2ZmIiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIyIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjUgMi41KSIvPjwvc3ZnPg==" }
271+ />
272+ </ Button >
273+ </ ButtonGroup >
274+ </ InputGroup >
275+ ) }
230276 </ div >
231277 ) ;
232278 }
@@ -262,7 +308,7 @@ const ModeToolsComponent = props => {
262308 />
263309
264310 { hasSimplifyOption && (
265- < Label text = { props . intl . formatMessage ( messages . eraserSimplify ) } >
311+ < Label text = { props . intl . formatMessage ( messages . eraserSimplify ) } style = { { marginLeft : 'calc(2 * .25rem)' } } >
266312 < LiveInput
267313 range
268314 small
@@ -274,8 +320,42 @@ const ModeToolsComponent = props => {
274320 />
275321 </ Label >
276322 ) }
323+
324+ { /* TODO replace this with a dropdown when we add more brush shapes */ }
325+ { hasSimplifyOption && (
326+ < InputGroup >
327+ < ButtonGroup >
328+ < Button
329+ className = {
330+ classNames ( styles . buttonGroupButton )
331+ }
332+ onClick = { ( ) => props . onBrushChange ( "CIRCLE" ) }
333+ >
334+ < img
335+ alt = { props . intl . formatMessage ( messages . brushCircle ) }
336+ className = { styles . buttonGroupButtonIcon }
337+ draggable = { false }
338+ src = { "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjMDBjM2ZmIiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIxMDAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuNSAyLjUpIi8+PC9zdmc+" }
339+ />
340+ </ Button >
341+ < Button
342+ className = {
343+ classNames ( styles . buttonGroupButton )
344+ }
345+ onClick = { ( ) => props . onBrushChange ( "SQUARE" ) }
346+ >
347+ < img
348+ alt = { props . intl . formatMessage ( messages . brushSquare ) }
349+ className = { styles . buttonGroupButtonIcon }
350+ draggable = { false }
351+ src = { "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjMDBjM2ZmIiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIyIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjUgMi41KSIvPjwvc3ZnPg==" }
352+ />
353+ </ Button >
354+ </ ButtonGroup >
355+ </ InputGroup >
356+ ) }
277357 </ div >
278- ) ;
358+ )
279359 }
280360 case Modes . ROUNDED_RECT :
281361 /* falls through */
@@ -419,7 +499,7 @@ const ModeToolsComponent = props => {
419499 const changeFunctionSimplify = props . onPenSimplifySliderChange ;
420500 return (
421501 < div className = { classNames ( props . className , styles . modeTools ) } >
422- < Label text = { props . intl . formatMessage ( messages . eraserSimplify ) } >
502+ < Label text = { props . intl . formatMessage ( messages . eraserSimplify ) } style = { { marginLeft : 'calc(2 * .25rem)' } } >
423503 < LiveInput
424504 range
425505 small
@@ -532,7 +612,7 @@ const ModeToolsComponent = props => {
532612 case Modes . BIT_SELECT :
533613 /* falls through */
534614 case Modes . SELECT :
535- const reshapingMethods = (
615+ const reshapingMethods = props . format . startsWith ( "BITMAP" ) ? null : (
536616 < InputGroup className = { classNames ( styles . modDashedBorder , styles . modLabeledIconHeight ) } >
537617 < LabeledIconButton
538618 hideLabel = { hideLabel ( props . intl . locale ) }
@@ -773,6 +853,7 @@ ModeToolsComponent.propTypes = {
773853 clipboardItems : PropTypes . arrayOf ( PropTypes . array ) ,
774854 eraserValue : PropTypes . number ,
775855 eraserSimplifyValue : PropTypes . number ,
856+ brushType : PropTypes . string ,
776857 penSimplifyValue : PropTypes . number ,
777858 roundedCornerValue : PropTypes . number ,
778859 roundedRectCornerValue : PropTypes . number ,
@@ -794,6 +875,7 @@ ModeToolsComponent.propTypes = {
794875 onCurvePoints : PropTypes . func . isRequired ,
795876 onDelete : PropTypes . func . isRequired ,
796877 onEraserSliderChange : PropTypes . func ,
878+ onBrushChange : PropTypes . func ,
797879 onEraserSimplifySliderChange : PropTypes . func ,
798880 onPenSimplifySliderChange : PropTypes . func ,
799881 onFillShapes : PropTypes . func . isRequired ,
@@ -823,6 +905,7 @@ const mapStateToProps = state => ({
823905 clipboardItems : state . scratchPaint . clipboard . items ,
824906 eraserValue : state . scratchPaint . eraserMode . brushSize ,
825907 eraserSimplifyValue : state . scratchPaint . eraserMode . simplifySize ,
908+ brushType : state . scratchPaint . brushType ,
826909 penSimplifyValue : state . scratchPaint . penMode . simplifySize ,
827910 roundedRectCornerValue : state . scratchPaint . roundedRectMode . roundedCornerSize ,
828911 roundedCornerValue : state . scratchPaint . rectMode . roundedCornerSize ,
@@ -864,6 +947,9 @@ const mapDispatchToProps = dispatch => ({
864947 onEraserSimplifySliderChange : eraserSize => {
865948 dispatch ( changeEraserSimplifySize ( eraserSize ) ) ;
866949 } ,
950+ onBrushChange : type => {
951+ dispatch ( setBrushType ( type ) ) ;
952+ } ,
867953 onPenSimplifySliderChange : eraserSize => {
868954 dispatch ( changePenSimplifySize ( eraserSize ) ) ;
869955 } ,
0 commit comments