mirror of
https://github.com/maputnik/editor.git
synced 2025-12-27 08:30:02 +00:00
Make the whole layer label draggable
This commit is contained in:
@@ -7,23 +7,16 @@ import {MdMenu, MdContentCopy, MdVisibility, MdVisibilityOff, MdDelete} from 're
|
||||
import LayerIcon from '../icons/LayerIcon'
|
||||
import {SortableElement, SortableHandle} from 'react-sortable-hoc'
|
||||
|
||||
class LayerTypeDragHandle extends React.Component {
|
||||
static propTypes = LayerIcon.propTypes
|
||||
|
||||
render() {
|
||||
return <div className="layer-handle">
|
||||
<div className="layer-handle__handle">
|
||||
<MdMenu style={{marginRight: "5px"}} />
|
||||
</div>
|
||||
<LayerIcon
|
||||
className="layer-handle__icon"
|
||||
{...this.props}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
const LayerTypeDragHandleSortable = SortableHandle((props) => <LayerTypeDragHandle {...props} />)
|
||||
const DraggableLabel = SortableHandle((props) => {
|
||||
return <div className="maputnik-layer-list-item-handle">
|
||||
<LayerIcon
|
||||
className="layer-handle__icon"
|
||||
type={props.layerType}
|
||||
/>
|
||||
<span className="maputnik-layer-list-item-id">{props.layerId}</span>
|
||||
</div>
|
||||
});
|
||||
|
||||
class IconAction extends React.Component {
|
||||
static propTypes = {
|
||||
@@ -111,8 +104,7 @@ class LayerListItem extends React.Component {
|
||||
"maputnik-layer-list-item-selected": this.props.isSelected,
|
||||
[this.props.className]: true,
|
||||
})}>
|
||||
<LayerTypeDragHandleSortable type={this.props.layerType} />
|
||||
<span className="maputnik-layer-list-item-id">{this.props.layerId}</span>
|
||||
<DraggableLabel {...this.props} />
|
||||
<span style={{flexGrow: 1}} />
|
||||
<IconAction
|
||||
wdKey={"layer-list-item:"+this.props.layerId+":delete"}
|
||||
|
||||
Reference in New Issue
Block a user