Skip to content

Commit 837f99d

Browse files
authored
Merge pull request #3458 from chrisgarrity/issue/3439-sprite-tooltips
Override default tooltip location
2 parents 57aed74 + b1a0ad4 commit 837f99d

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

src/components/asset-panel/selector.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const Selector = props => {
1515
buttons,
1616
containerRef,
1717
dragType,
18+
isRtl,
1819
items,
1920
selectedItemIndex,
2021
draggingIndex,
@@ -41,6 +42,7 @@ const Selector = props => {
4142
img={img}
4243
moreButtons={moreButtons}
4344
title={title}
45+
tooltipPlace={isRtl ? 'left' : 'right'}
4446
onClick={onClick}
4547
/>
4648
</Box>
@@ -98,6 +100,7 @@ Selector.propTypes = {
98100
dragType: PropTypes.oneOf(Object.keys(DragConstants)),
99101
draggingIndex: PropTypes.number,
100102
draggingType: PropTypes.oneOf(Object.keys(DragConstants)),
103+
isRtl: PropTypes.bool,
101104
items: PropTypes.arrayOf(PropTypes.shape({
102105
url: PropTypes.string,
103106
name: PropTypes.string.isRequired

src/components/sprite-selector/sprite-selector.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const SpriteSelectorComponent = function (props) {
140140
}
141141
]}
142142
title={intl.formatMessage(messages.addSpriteFromLibrary)}
143-
tooltipPlace={isRtl(intl.locale) ? 'left' : 'right'}
143+
tooltipPlace={isRtl(intl.locale) ? 'right' : 'left'}
144144
onClick={onNewSpriteClick}
145145
/>
146146
</Box>

src/components/stage-selector/stage-selector.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {defineMessages, intlShape, injectIntl, FormattedMessage} from 'react-int
66
import Box from '../box/box.jsx';
77
import ActionMenu from '../action-menu/action-menu.jsx';
88
import styles from './stage-selector.css';
9+
import {isRtl} from 'scratch-l10n';
910

1011
import backdropIcon from '../action-menu/icon--backdrop.svg';
1112
import fileUploadIcon from '../action-menu/icon--file-upload.svg';
@@ -120,6 +121,7 @@ const StageSelector = props => {
120121
}
121122
]}
122123
title={intl.formatMessage(messages.addBackdropFromLibrary)}
124+
tooltipPlace={isRtl(intl.locale) ? 'right' : 'left'}
123125
onClick={onNewBackdropClick}
124126
/>
125127
</Box>

src/containers/costume-tab.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ class CostumeTab extends React.Component {
235235
const {
236236
dispatchUpdateRestore, // eslint-disable-line no-unused-vars
237237
intl,
238+
isRtl,
238239
onNewCostumeFromCameraClick,
239240
onNewLibraryBackdropClick,
240241
onNewLibraryCostumeClick,
@@ -300,6 +301,7 @@ class CostumeTab extends React.Component {
300301
}
301302
]}
302303
dragType={DragConstants.COSTUME}
304+
isRtl={isRtl}
303305
items={costumeData}
304306
selectedItemIndex={this.state.selectedCostumeIndex}
305307
onDeleteClick={target && target.costumes && target.costumes.length > 1 ?
@@ -330,6 +332,7 @@ CostumeTab.propTypes = {
330332
dispatchUpdateRestore: PropTypes.func,
331333
editingTarget: PropTypes.string,
332334
intl: intlShape,
335+
isRtl: PropTypes.bool,
333336
onActivateSoundsTab: PropTypes.func.isRequired,
334337
onNewCostumeFromCameraClick: PropTypes.func.isRequired,
335338
onNewLibraryBackdropClick: PropTypes.func.isRequired,
@@ -354,6 +357,7 @@ CostumeTab.propTypes = {
354357

355358
const mapStateToProps = state => ({
356359
editingTarget: state.scratchGui.targets.editingTarget,
360+
isRtl: state.locales.isRtl,
357361
sprites: state.scratchGui.targets.sprites,
358362
stage: state.scratchGui.targets.stage,
359363
dragging: state.scratchGui.assetDrag.dragging,

src/containers/sound-tab.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ class SoundTab extends React.Component {
230230
onClick: onNewSoundFromLibraryClick
231231
}]}
232232
dragType={DragConstants.SOUND}
233+
isRtl={isRtl}
233234
items={sounds}
234235
selectedItemIndex={this.state.selectedSoundIndex}
235236
onDeleteClick={this.handleDeleteSound}

0 commit comments

Comments
 (0)