mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: desloppify code quality improvements (-353 lines)
- Remove unused Vector2 type export from litegraph barrel - Extract INITIAL_BRUSH and DEFAULT_BRUSH constants in maskEditorStore to fix inconsistent defaults between init and reset paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
import type { ContextMenu } from './ContextMenu'
|
||||
import type { LGraphNode } from './LGraphNode'
|
||||
import { LiteGraphGlobal } from './LiteGraphGlobal'
|
||||
import type {
|
||||
ConnectingLink,
|
||||
IContextMenuOptions,
|
||||
Point,
|
||||
Size
|
||||
} from './interfaces'
|
||||
import type { ConnectingLink, IContextMenuOptions, Size } from './interfaces'
|
||||
import { loadPolyfills } from './polyfills'
|
||||
import type { CanvasEventDetail } from './types/events'
|
||||
import type { RenderShape, TitleMode } from './types/globalEnums'
|
||||
@@ -24,8 +19,6 @@ loadPolyfills()
|
||||
// Type definitions for litegraph.js 0.7.0
|
||||
// Project: litegraph.js
|
||||
// Definitions by: NateScarlet <https://github.com/NateScarlet>
|
||||
/** @deprecated Use {@link Point} instead. */
|
||||
export type Vector2 = Point
|
||||
|
||||
interface IContextMenuItem {
|
||||
content: string
|
||||
|
||||
@@ -17,14 +17,24 @@ import type {
|
||||
} from '@/extensions/core/maskeditor/types'
|
||||
import { useCanvasHistory } from '@/composables/maskeditor/useCanvasHistory'
|
||||
|
||||
const INITIAL_BRUSH: Brush = {
|
||||
type: BrushShape.Arc,
|
||||
size: 10,
|
||||
opacity: 0.7,
|
||||
hardness: 1,
|
||||
stepSize: 10
|
||||
}
|
||||
|
||||
const DEFAULT_BRUSH: Brush = {
|
||||
type: BrushShape.Arc,
|
||||
size: 20,
|
||||
opacity: 1,
|
||||
hardness: 1,
|
||||
stepSize: 5
|
||||
}
|
||||
|
||||
export const useMaskEditorStore = defineStore('maskEditor', () => {
|
||||
const brushSettings = ref<Brush>({
|
||||
type: BrushShape.Arc,
|
||||
size: 10,
|
||||
opacity: 0.7,
|
||||
hardness: 1,
|
||||
stepSize: 10
|
||||
})
|
||||
const brushSettings = ref<Brush>({ ...INITIAL_BRUSH })
|
||||
|
||||
const maskBlendMode = ref<MaskBlendMode>(MaskBlendMode.Black)
|
||||
const activeLayer = ref<ImageLayer>('mask')
|
||||
@@ -147,11 +157,7 @@ export const useMaskEditorStore = defineStore('maskEditor', () => {
|
||||
}
|
||||
|
||||
function resetBrushToDefault(): void {
|
||||
brushSettings.value.type = BrushShape.Arc
|
||||
brushSettings.value.size = 20
|
||||
brushSettings.value.opacity = 1
|
||||
brushSettings.value.hardness = 1
|
||||
brushSettings.value.stepSize = 5
|
||||
brushSettings.value = { ...DEFAULT_BRUSH }
|
||||
}
|
||||
|
||||
function setPaintBucketTolerance(tolerance: number): void {
|
||||
@@ -199,13 +205,7 @@ export const useMaskEditorStore = defineStore('maskEditor', () => {
|
||||
}
|
||||
|
||||
function resetState(): void {
|
||||
brushSettings.value = {
|
||||
type: BrushShape.Arc,
|
||||
size: 10,
|
||||
opacity: 0.7,
|
||||
hardness: 1,
|
||||
stepSize: 5
|
||||
}
|
||||
brushSettings.value = { ...INITIAL_BRUSH }
|
||||
maskBlendMode.value = MaskBlendMode.Black
|
||||
activeLayer.value = 'mask'
|
||||
rgbColor.value = '#FF0000'
|
||||
|
||||
Reference in New Issue
Block a user