Files
iD/modules/ui/tools/sidebar_toggle.js
Quincy Morgan 523a467836 2.x: Make toolbar horizontally scrollable when it overflows (re: #6755, re: 7545f67063b5e7007ef2d8367e3181e59c04a487)
Generalize tooltip into popover control
Use the same popover control for tooltip as the preset browser and tools list popovers
Smartly position the preset browser popover and menu bar tooltips to stay fully onscreen
Position most tooltips closer to their controls
Fix small gap that could appear between a tooltip and its arrow
Allow wider toolbar tooltips
2019-12-16 13:30:07 -05:00

32 lines
966 B
JavaScript

import { select as d3_select } from 'd3-selection';
import { t, textDirection } from '../../util/locale';
import { svgIcon } from '../../svg';
import { uiTooltipHtml } from '../tooltipHtml';
import { tooltip } from '../../util/tooltip';
export function uiToolSidebarToggle(context) {
var tool = {
id: 'sidebar_toggle',
label: t('toolbar.inspect')
};
tool.render = function(selection) {
selection
.append('button')
.attr('class', 'bar-button')
.on('click', function() {
context.ui().sidebar.toggle();
})
.call(tooltip()
.placement('bottom')
.html(true)
.title(uiTooltipHtml(t('sidebar.tooltip'), t('sidebar.key')))
.scrollContainer(d3_select('#bar'))
)
.call(svgIcon('#iD-icon-sidebar-' + (textDirection === 'rtl' ? 'right' : 'left')));
};
return tool;
}