Skip to content

Commit

Permalink
fix: Text, stroke and fill palettes not showing with custom buttons [P…
Browse files Browse the repository at this point in the history
…T-182016906]

This adds code to also load the palette buttons when the text, stroke and fill tools are used in the custom button settings.

NOTE: Although this is a bugfix there was already a 2.3.0-pre.1 package on npm so I had to use a minor version upgrade instead of a bugfix semver bump.
  • Loading branch information
dougmartin committed Jan 16, 2024
1 parent cb0536e commit 0be5a09
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
8 changes: 8 additions & 0 deletions app/scripts/ui/ui-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ function UIManager(drawingTool) {
const addLineButtons = button === 'linesPalette';
const addStampButtons = button === 'stamp';
const addShapeButtons = button === 'shapesPalette';
const addFontSizeButtons = button === 'text';
const addStrokeColorButtons = button === 'strokeColorPalette';
const addStrokeWidthButtons = button === 'strokeWidthPalette';
const addFillColorButtons = button === 'fillColorPalette';
uiDef.buttons.forEach(buttonDef => {
const addButtonDef = (buttonDef.name === button) ||
(addLineButtons && buttonDef.palette === 'lines') ||
(addShapeButtons && buttonDef.palette === 'shapes') ||
(addFontSizeButtons && buttonDef.palette === 'fontSizes') ||
(addStrokeColorButtons && buttonDef.palette === 'strokeColors') ||
(addStrokeWidthButtons && buttonDef.palette === 'strokeWidths') ||
(addFillColorButtons && buttonDef.palette === 'fillColors') ||
(addStampButtons && ((buttonDef.palette === 'stampCategories') || (buttonDef.palette.indexOf('StampsPalette') >= 0)));
if (addButtonDef) {
customButtonDefs.push(buttonDef);
Expand Down
2 changes: 1 addition & 1 deletion dist/drawing-tool.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/drawing-tool.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions dist/examples/custom-button-order.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
'free',
'shapesPalette',
'stamp',
'text',
'linesPalette',
'strokeColorPalette',
'fillColorPalette',
'strokeWidthPalette',
'clone',
'sendToBack',
'sendToFront',
'annotation',
'trash'
]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drawing-tool",
"description": "HTML5 Drawing Tool",
"author": "",
"version": "2.3.0-pre.1",
"version": "2.3.0",
"bugs": {
"url": "https://github.com/concord-consortium/drawing-tool/issues"
},
Expand Down
8 changes: 8 additions & 0 deletions public/examples/custom-button-order.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
'free',
'shapesPalette',
'stamp',
'text',
'linesPalette',
'strokeColorPalette',
'fillColorPalette',
'strokeWidthPalette',
'clone',
'sendToBack',
'sendToFront',
'annotation',
'trash'
]
Expand Down

0 comments on commit 0be5a09

Please sign in to comment.