mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
perf(ui): do not use stage.find
This commit is contained in:
parent
440ff40ad5
commit
f2fa41afc5
@ -8,7 +8,7 @@ import { clamp } from 'lodash-es';
|
|||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
import { BRUSH_SPACING_TARGET_SCALE, CANVAS_SCALE_BY, MAX_CANVAS_SCALE, MIN_CANVAS_SCALE } from './constants';
|
import { BRUSH_SPACING_TARGET_SCALE, CANVAS_SCALE_BY, MAX_CANVAS_SCALE, MIN_CANVAS_SCALE } from './constants';
|
||||||
import { getBrushLineId, PREVIEW_TOOL_GROUP_ID } from './naming';
|
import { getBrushLineId } from './naming';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the last cursor position atom with the current cursor position, returning the new position or `null` if the
|
* Updates the last cursor position atom with the current cursor position, returning the new position or `null` if the
|
||||||
@ -363,10 +363,6 @@ export const setStageEventHandlers = (manager: CanvasManager): (() => void) => {
|
|||||||
const selectedEntity = getSelectedEntity();
|
const selectedEntity = getSelectedEntity();
|
||||||
const selectedEntityAdapter = getSelectedEntityAdapter();
|
const selectedEntityAdapter = getSelectedEntityAdapter();
|
||||||
|
|
||||||
stage
|
|
||||||
.findOne<Konva.Layer>(`#${PREVIEW_TOOL_GROUP_ID}`)
|
|
||||||
?.visible(toolState.selected === 'brush' || toolState.selected === 'eraser');
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
pos &&
|
pos &&
|
||||||
selectedEntity &&
|
selectedEntity &&
|
||||||
@ -500,8 +496,6 @@ export const setStageEventHandlers = (manager: CanvasManager): (() => void) => {
|
|||||||
const selectedEntity = getSelectedEntity();
|
const selectedEntity = getSelectedEntity();
|
||||||
const toolState = getToolState();
|
const toolState = getToolState();
|
||||||
|
|
||||||
stage.findOne<Konva.Layer>(`#${PREVIEW_TOOL_GROUP_ID}`)?.visible(false);
|
|
||||||
|
|
||||||
if (pos && selectedEntity && isDrawableEntity(selectedEntity) && !getSpaceKey() && getIsMouseDown()) {
|
if (pos && selectedEntity && isDrawableEntity(selectedEntity) && !getSpaceKey() && getIsMouseDown()) {
|
||||||
if (getIsMouseDown()) {
|
if (getIsMouseDown()) {
|
||||||
if (toolState.selected === 'brush') {
|
if (toolState.selected === 'brush') {
|
||||||
|
Loading…
Reference in New Issue
Block a user