tidy(ui): type "Dimensions" -> "Size"

This commit is contained in:
psychedelicious
2024-06-25 19:23:18 +10:00
parent 07beb170be
commit 54ff94ec38
11 changed files with 32 additions and 32 deletions

View File

@@ -1,12 +1,12 @@
import type { PayloadAction, SliceCaseReducers } from '@reduxjs/toolkit';
import type { BoundingBoxScaleMethod, CanvasV2State, Dimensions } from 'features/controlLayers/store/types';
import type { BoundingBoxScaleMethod, CanvasV2State, Size } from 'features/controlLayers/store/types';
import { getScaledBoundingBoxDimensions } from 'features/controlLayers/util/getScaledBoundingBoxDimensions';
import { getOptimalDimension } from 'features/parameters/util/optimalDimension';
import type { IRect } from 'konva/lib/types';
import { pick } from 'lodash-es';
export const bboxReducers = {
scaledBboxChanged: (state, action: PayloadAction<Partial<Dimensions>>) => {
scaledBboxChanged: (state, action: PayloadAction<Partial<Size>>) => {
state.layers.imageCache = null;
state.bbox.scaledSize = { ...state.bbox.scaledSize, ...action.payload };
},

View File

@@ -780,7 +780,7 @@ export const isBoundingBoxScaleMethod = (v: unknown): v is BoundingBoxScaleMetho
export type CanvasEntity = LayerEntity | ControlAdapterEntity | RegionEntity | InpaintMaskEntity | IPAdapterEntity;
export type CanvasEntityIdentifier = Pick<CanvasEntity, 'id' | 'type'>;
export type Dimensions = {
export type Size = {
width: number;
height: number;
};

View File

@@ -1,6 +1,6 @@
import { roundToMultiple } from 'common/util/roundDownToMultiple';
import { CANVAS_GRID_SIZE_FINE } from 'features/controlLayers/konva/constants';
import type { Dimensions } from 'features/controlLayers/store/types';
import type { Size } from 'features/controlLayers/store/types';
/**
* Scales the bounding box dimensions to the optimal dimension. The optimal dimensions should be the trained dimension
@@ -8,7 +8,7 @@ import type { Dimensions } from 'features/controlLayers/store/types';
* @param dimensions The un-scaled bbox dimensions
* @param optimalDimension The optimal dimension to scale the bbox to
*/
export const getScaledBoundingBoxDimensions = (dimensions: Dimensions, optimalDimension: number): Dimensions => {
export const getScaledBoundingBoxDimensions = (dimensions: Size, optimalDimension: number): Size => {
const { width, height } = dimensions;
const scaledDimensions = { width, height };