Skip to content

Commit

Permalink
Fix keybindings ordering and tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
underoot committed Dec 4, 2024
1 parent e09cd74 commit 419bf96
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,22 @@ export default function(ctx) {

if (!controls) return controlGroup;

if (controls[Constants.types.POINT]) {
buttonElements[Constants.types.POINT] = createControlButton(Constants.types.POINT, {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_POINT,
title: `Marker tool ${ctx.options.keybindings ? '(1)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POINT),
onDeactivate: () => ctx.events.trash()
});
}


if (controls[Constants.types.LINE]) {
buttonElements[Constants.types.LINE] = createControlButton(Constants.types.LINE, {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_LINE,
title: `LineString tool ${ctx.options.keybindings ? '(l)' : ''}`,
title: `LineString tool ${ctx.options.keybindings ? '(2)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_LINE_STRING),
onDeactivate: () => ctx.events.trash()
});
Expand All @@ -118,22 +129,12 @@ export default function(ctx) {
buttonElements[Constants.types.POLYGON] = createControlButton(Constants.types.POLYGON, {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_POLYGON,
title: `Polygon tool ${ctx.options.keybindings ? '(p)' : ''}`,
title: `Polygon tool ${ctx.options.keybindings ? '(3)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POLYGON),
onDeactivate: () => ctx.events.trash()
});
}

if (controls[Constants.types.POINT]) {
buttonElements[Constants.types.POINT] = createControlButton(Constants.types.POINT, {
container: controlGroup,
className: Constants.classes.CONTROL_BUTTON_POINT,
title: `Marker tool ${ctx.options.keybindings ? '(m)' : ''}`,
onActivate: () => ctx.events.changeMode(Constants.modes.DRAW_POINT),
onDeactivate: () => ctx.events.trash()
});
}

if (controls.trash) {
buttonElements.trash = createControlButton('trash', {
container: controlGroup,
Expand Down

0 comments on commit 419bf96

Please sign in to comment.