feat/mask-editor-brush-step-size (#9730)

## Summary

Fix #9727
FYI #9534

## GIMP Source

Accroding to GIMP( like open-source Adobe
Photoshop)`/composables/maskeditor/useBrushDrawing.ts`,
```
const brushStepSizeSliderValue = computed({
  get: () => {
    if (rawStepSizeSliderValue.value !== null) {
      const cachedSize = Math.round(Math.pow(100, rawStepSizeSliderValue.value))
      if (cachedSize === brushStepSize.value) {
        return rawStepSizeSliderValue.value
      }
    }
    return Math.log(brushStepSize.value) / Math.log(100)
  },
  set: (value: number) => {
    rawStepSizeSliderValue.value = value
    const size = Math.round(Math.pow(100, value))
    store.setBrushStepSize(size)
  }
})
```

## Screenshot


https://github.com/user-attachments/assets/971e7bd9-9690-475f-b214-33d06939d2ef

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9730-feat-mask-editor-brush-step-size-3206d73d36508198b934e0fb374eb5a9)
by [Unito](https://www.unito.io)

Co-authored-by: Christian Byrne <cbyrne@comfy.org>
This commit is contained in:
Kelly Yang
2026-03-12 09:01:44 -07:00
committed by GitHub
parent bacb5570c8
commit 34b1799b21

View File

@@ -924,7 +924,8 @@ export function useBrushDrawing(initialSettings?: {
}
// Calculate target spacing based on step size percentage
const stepPercentage = store.brushSettings.stepSize / 100
const stepPercentage =
Math.pow(100, store.brushSettings.stepSize / 100) / 100
const targetSpacing = Math.max(
1.0,
store.brushSettings.size * stepPercentage
@@ -1483,7 +1484,8 @@ export function useBrushDrawing(initialSettings?: {
const dist = Math.hypot(p2.x - p1.x, p2.y - p1.y)
// Calculate target spacing based on stepSize
const stepPercentage = store.brushSettings.stepSize / 100
const stepPercentage =
Math.pow(100, store.brushSettings.stepSize / 100) / 100
const stepSize = Math.max(
1.0,
store.brushSettings.size * stepPercentage