diff --git a/src/tools/brush-selection.ts b/src/tools/brush-selection.ts index 95b2c3e7..931037f4 100644 --- a/src/tools/brush-selection.ts +++ b/src/tools/brush-selection.ts @@ -24,7 +24,6 @@ class BrushSelection { const prev = { x: 0, y: 0 }; let dragId: number | undefined; - let wheelModeBrushSize = false; const update = (e: PointerEvent) => { const x = e.offsetX; @@ -106,27 +105,13 @@ class BrushSelection { }; const wheel = (e: WheelEvent) => { - if(wheelModeBrushSize){ - if(e.deltaY > 0) - radius = Math.max(1, radius * 1.05); - else - radius = Math.max(1, radius / 1.05); - circle.setAttribute('r', radius.toString()); + if (e.shiftKey && e.deltaX !== 0) { + events.fire(e.deltaX > 0 ? 'tool.brushSelection.smaller' : 'tool.brushSelection.bigger'); e.preventDefault(); e.stopPropagation(); } }; - const keydown = (e: KeyboardEvent) => { - if (e.shiftKey) { - wheelModeBrushSize = true; - } - }; - - const keyup = (e: KeyboardEvent) => { - wheelModeBrushSize = false; - }; - this.activate = () => { svg.style.display = 'inline'; parent.style.display = 'block'; @@ -134,8 +119,6 @@ class BrushSelection { parent.addEventListener('pointermove', pointermove); parent.addEventListener('pointerup', pointerup); parent.addEventListener('wheel', wheel); - document.addEventListener('keydown', keydown); - document.addEventListener('keyup', keyup); }; this.deactivate = () => { @@ -149,9 +132,6 @@ class BrushSelection { parent.removeEventListener('pointermove', pointermove); parent.removeEventListener('pointerup', pointerup); parent.removeEventListener('wheel', wheel); - document.removeEventListener('keydown', keydown); - document.removeEventListener('keyup', keyup); - wheelModeBrushSize = false; }; events.on('tool.brushSelection.smaller', () => { diff --git a/src/ui/color-panel.ts b/src/ui/color-panel.ts index 571b7ea1..e906cddf 100644 --- a/src/ui/color-panel.ts +++ b/src/ui/color-panel.ts @@ -214,13 +214,15 @@ class ColorPanel extends Container { tintClr: selected.tintClr.clone(), brightness: selected.brightness, blackPoint: selected.blackPoint, - whitePoint: selected.whitePoint + whitePoint: selected.whitePoint, + transparency: selected.transparency }, oldState: { tintClr: selected.tintClr.clone(), brightness: selected.brightness, blackPoint: selected.blackPoint, - whitePoint: selected.whitePoint + whitePoint: selected.whitePoint, + transparency: selected.transparency } }); } @@ -233,6 +235,7 @@ class ColorPanel extends Container { newState.brightness = brightnessSlider.value; newState.blackPoint = blackPointSlider.value; newState.whitePoint = whitePointSlider.value; + newState.transparency = Math.exp(transparencySlider.value); events.fire('edit.add', op); op = null; }