Skip to content

Commit

Permalink
fix(PaintControls): when clicking transparent eraser palette swatch
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Sep 12, 2023
1 parent 5190610 commit b0d7915
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/PaintControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ export default defineComponent({
});
const setBrushColor = (color: string) => {
const hexa = `${color}FF`.toUpperCase();
if (hexa in hexToValue) {
paintStore.setBrushValue(hexToValue[hexa]);
const withAlpha = color.length === 9 ? color : `${color}FF`;
const hexa = withAlpha.toUpperCase();
const brushValue = hexToValue[hexa];
if (brushValue == null) {
throw new Error(`Brush value invalid`);
}
paintStore.setBrushValue(brushValue);
};
const brushSize = computed(() => paintStore.brushSize);
Expand Down

0 comments on commit b0d7915

Please sign in to comment.