Merge pull request #173 from fsih/copyPaste

Move copy/paste to mode tools
This commit is contained in:
DD Liu 2017-11-01 15:12:02 -04:00 committed by GitHub
commit 80a58bb90f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 40 deletions

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 852 B

View file

@ -1,3 +1,4 @@
@import "../../css/colors.css";
@import "../../css/units.css"; @import "../../css/units.css";
.mode-tools { .mode-tools {
@ -11,3 +12,12 @@
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
} }
.mod-dashed-border {
border-right: 1px dashed $ui-pane-border;
padding-right: calc(3 * $grid-unit);
}
.mod-labeled-icon-height {
height: 2.85rem; /* for the second row so the dashed borders are equal in size */
}

View file

@ -7,32 +7,49 @@ import {changeBrushSize} from '../../reducers/brush-mode';
import {changeBrushSize as changeEraserSize} from '../../reducers/eraser-mode'; import {changeBrushSize as changeEraserSize} from '../../reducers/eraser-mode';
import BufferedInputHOC from '../forms/buffered-input-hoc.jsx'; import BufferedInputHOC from '../forms/buffered-input-hoc.jsx';
import {injectIntl, intlShape} from 'react-intl'; import {defineMessages, injectIntl, intlShape} from 'react-intl';
import Input from '../forms/input.jsx'; import Input from '../forms/input.jsx';
import InputGroup from '../input-group/input-group.jsx';
import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx';
// import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx'; // import LabeledIconButton from '../labeled-icon-button/labeled-icon-button.jsx';
import Modes from '../../modes/modes'; import Modes from '../../modes/modes';
import styles from './mode-tools.css'; import styles from './mode-tools.css';
import copyIcon from './icons/copy.svg';
import pasteIcon from './icons/paste.svg';
import brushIcon from '../brush-mode/brush.svg'; import brushIcon from '../brush-mode/brush.svg';
// import curvedPointIcon from './curved-point.svg'; // import curvedPointIcon from './curved-point.svg';
import eraserIcon from '../eraser-mode/eraser.svg'; import eraserIcon from '../eraser-mode/eraser.svg';
// import flipHorizontalIcon from './flip-horizontal.svg'; // import flipHorizontalIcon from './icons/flip-horizontal.svg';
// import flipVerticalIcon from './flip-vertical.svg'; // import flipVerticalIcon from './icons/flip-vertical.svg';
// import straightPointIcon from './straight-point.svg'; // import straightPointIcon from './straight-point.svg';
import {MAX_STROKE_WIDTH} from '../../reducers/stroke-width'; import {MAX_STROKE_WIDTH} from '../../reducers/stroke-width';
const BufferedInput = BufferedInputHOC(Input); const BufferedInput = BufferedInputHOC(Input);
const ModeToolsComponent = props => { const ModeToolsComponent = props => {
const brushMessage = props.intl.formatMessage({ const messages = defineMessages({
defaultMessage: 'Brush', brushSize: {
description: 'Label for the brush tool', defaultMessage: 'Brush size',
id: 'paint.brushMode.brush' description: 'Label for the brush size input',
}); id: 'paint.modeTools.brushSize'
const eraserMessage = props.intl.formatMessage({ },
defaultMessage: 'Eraser', eraserSize: {
description: 'Label for the eraser tool', defaultMessage: 'Eraser size',
id: 'paint.eraserMode.eraser' description: 'Label for the eraser size input',
id: 'paint.modeTools.eraserSize'
},
copy: {
defaultMessage: 'Copy',
description: 'Label for the copy button',
id: 'paint.modeTools.copy'
},
paste: {
defaultMessage: 'Paste',
description: 'Label for the paste button',
id: 'paint.modeTools.paste'
}
}); });
switch (props.mode) { switch (props.mode) {
@ -41,7 +58,7 @@ const ModeToolsComponent = props => {
<div className={classNames(props.className, styles.modeTools)}> <div className={classNames(props.className, styles.modeTools)}>
<div> <div>
<img <img
alt={brushMessage} alt={props.intl.formatMessage(messages.brushSize)}
className={styles.modeToolsIcon} className={styles.modeToolsIcon}
src={brushIcon} src={brushIcon}
/> />
@ -61,7 +78,7 @@ const ModeToolsComponent = props => {
<div className={classNames(props.className, styles.modeTools)}> <div className={classNames(props.className, styles.modeTools)}>
<div> <div>
<img <img
alt={eraserMessage} alt={props.intl.formatMessage(messages.eraserSize)}
className={styles.modeToolsIcon} className={styles.modeToolsIcon}
src={eraserIcon} src={eraserIcon}
/> />
@ -96,6 +113,20 @@ const ModeToolsComponent = props => {
case Modes.SELECT: case Modes.SELECT:
return ( return (
<div className={classNames(props.className, styles.modeTools)}> <div className={classNames(props.className, styles.modeTools)}>
<InputGroup className={classNames(styles.modDashedBorder, styles.modLabeledIconHeight)}>
<LabeledIconButton
disabled
imgSrc={copyIcon}
title={props.intl.formatMessage(messages.copy)}
onClick={function () {}}
/>
<LabeledIconButton
disabled
imgSrc={pasteIcon}
title={props.intl.formatMessage(messages.paste)}
onClick={function () {}}
/>
</InputGroup>
{/* <LabeledIconButton {/* <LabeledIconButton
imgAlt="Flip Horizontal Icon" imgAlt="Flip Horizontal Icon"
imgSrc={flipHorizontalIcon} imgSrc={flipHorizontalIcon}

View file

@ -30,9 +30,7 @@ import StrokeWidthIndicatorComponent from '../../containers/stroke-width-indicat
import styles from './paint-editor.css'; import styles from './paint-editor.css';
import copyIcon from './icons/copy.svg';
import groupIcon from './icons/group.svg'; import groupIcon from './icons/group.svg';
import pasteIcon from './icons/paste.svg';
import redoIcon from './icons/redo.svg'; import redoIcon from './icons/redo.svg';
import sendBackIcon from './icons/send-back.svg'; import sendBackIcon from './icons/send-back.svg';
import sendBackwardIcon from './icons/send-backward.svg'; import sendBackwardIcon from './icons/send-backward.svg';
@ -90,16 +88,6 @@ const messages = defineMessages({
defaultMessage: 'Back', defaultMessage: 'Back',
description: 'Label for the `Send to back of canvas` button', description: 'Label for the `Send to back of canvas` button',
id: 'paint.paintEditor.back' id: 'paint.paintEditor.back'
},
copy: {
defaultMessage: 'Copy',
description: 'Label for the copy button',
id: 'paint.paintEditor.copy'
},
paste: {
defaultMessage: 'Paste',
description: 'Label for the paste button',
id: 'paint.paintEditor.paste'
} }
}); });
@ -258,20 +246,6 @@ class PaintEditorComponent extends React.Component {
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
</InputGroup> </InputGroup>
<InputGroup className={classNames(styles.modDashedBorder, styles.modLabeledIconHeight)}>
<LabeledIconButton
disabled
imgSrc={copyIcon}
title={this.props.intl.formatMessage(messages.copy)}
onClick={function () {}}
/>
<LabeledIconButton
disabled
imgSrc={pasteIcon}
title={this.props.intl.formatMessage(messages.paste)}
onClick={function () {}}
/>
</InputGroup>
<InputGroup className={styles.modModeTools}> <InputGroup className={styles.modModeTools}>
<ModeToolsComponent /> <ModeToolsComponent />
</InputGroup> </InputGroup>