This commit is contained in:
orangemug 2018-05-28 11:15:16 +01:00
parent 0aabd33538
commit c71fbcf436
4 changed files with 11 additions and 7 deletions

View file

@ -167,7 +167,7 @@ export default class App extends React.Component {
}) })
} }
onSortEnd(move) { onMoveLayer(move) {
let { oldIndex, newIndex } = move; let { oldIndex, newIndex } = move;
let layers = this.state.mapStyle.layers; let layers = this.state.mapStyle.layers;
oldIndex = clamp(oldIndex, 0, layers.length-1); oldIndex = clamp(oldIndex, 0, layers.length-1);
@ -352,7 +352,7 @@ export default class App extends React.Component {
/> />
const layerList = <LayerList const layerList = <LayerList
onSortEnd={this.onSortEnd.bind(this)} onMoveLayer={this.onMoveLayer.bind(this)}
onLayerDestroy={this.onLayerDestroy.bind(this)} onLayerDestroy={this.onLayerDestroy.bind(this)}
onLayerCopy={this.onLayerCopy.bind(this)} onLayerCopy={this.onLayerCopy.bind(this)}
onLayerVisibilityToggle={this.onLayerVisibilityToggle.bind(this)} onLayerVisibilityToggle={this.onLayerVisibilityToggle.bind(this)}
@ -371,7 +371,7 @@ export default class App extends React.Component {
sources={this.state.sources} sources={this.state.sources}
vectorLayers={this.state.vectorLayers} vectorLayers={this.state.vectorLayers}
spec={this.state.spec} spec={this.state.spec}
onSortEnd={this.onSortEnd.bind(this)} onMoveLayer={this.onMoveLayer.bind(this)}
onLayerChanged={this.onLayerChanged.bind(this)} onLayerChanged={this.onLayerChanged.bind(this)}
onLayerDestroy={this.onLayerDestroy.bind(this)} onLayerDestroy={this.onLayerDestroy.bind(this)}
onLayerCopy={this.onLayerCopy.bind(this)} onLayerCopy={this.onLayerCopy.bind(this)}

View file

@ -1,7 +1,6 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Wrapper, Button, Menu, MenuItem } from 'react-aria-menubutton' import { Wrapper, Button, Menu, MenuItem } from 'react-aria-menubutton'
import classnames from 'classnames'
import JSONEditor from './JSONEditor' import JSONEditor from './JSONEditor'
import FilterEditor from '../filter/FilterEditor' import FilterEditor from '../filter/FilterEditor'
@ -181,7 +180,7 @@ export default class LayerEditor extends React.Component {
} }
moveLayer(offset) { moveLayer(offset) {
this.props.onSortEnd({ this.props.onMoveLayer({
oldIndex: this.props.layerIndex, oldIndex: this.props.layerIndex,
newIndex: this.props.layerIndex+offset newIndex: this.props.layerIndex+offset
}) })
@ -250,7 +249,7 @@ export default class LayerEditor extends React.Component {
closeOnSelection={false} closeOnSelection={false}
> >
<Button className='more-menu__button'> <Button className='more-menu__button'>
<MoreVertIcon width="22px" height="22px" /> <MoreVertIcon className="more-menu__button__svg" />
</Button> </Button>
<Menu> <Menu>
<ul className="more-menu__menu"> <ul className="more-menu__menu">

View file

@ -208,7 +208,7 @@ export default class LayerList extends React.Component {
render() { render() {
return <LayerListContainer return <LayerListContainer
{...this.props} {...this.props}
onSortEnd={this.props.onSortEnd.bind(this)} onSortEnd={this.props.onMoveLayer.bind(this)}
useDragHandle={true} useDragHandle={true}
/> />
} }

View file

@ -192,6 +192,11 @@
min-width: 120px; min-width: 120px;
} }
&__button__svg {
width: 24px;
height: 24px;
}
&__menu__item { &__menu__item {
padding: 4px; padding: 4px;
} }