npm run format

This commit is contained in:
2025-02-01 16:18:33 +01:00
parent d65ceba66a
commit e53e154d16
8 changed files with 35 additions and 56 deletions

View File

@ -1,10 +1,10 @@
import { Direction } from '@/application/enums'
import { type MapCharacter } from '@/application/types'
import { loadSpriteTextures } from '@/composables/gameComposable'
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/mapComposable'
import { CharacterTypeStorage } from '@/storage/storages'
import { refObj } from 'phavuer'
import { computed, ref } from 'vue'
import { Direction } from '@/application/enums'
export function useCharacterSprite(scene: Phaser.Scene, tilemap: Phaser.Tilemaps.Tilemap, mapCharacter: MapCharacter) {
const characterContainer = refObj<Phaser.GameObjects.Container>()
@ -133,4 +133,4 @@ export function useCharacterSprite(scene: Phaser.Scene, tilemap: Phaser.Tilemaps
initializeSprite,
cleanup
}
}
}

View File

@ -1,7 +1,7 @@
import { ref } from 'vue'
import config from '@/application/config'
import type { Tile } from '@/application/types'
import type { TileAnalysisResult, TileWorkerMessage } from '@/types/tileTypes'
import { ref } from 'vue'
// Constants for image processing
const DOWNSCALE_WIDTH = 32
@ -60,13 +60,12 @@ export function useTileProcessingComposable() {
isProcessing = true
const batch = processingQueue.value.splice(0, BATCH_SIZE)
Promise.all(batch.map(tile => processTileAsync(tile)))
.then(() => {
isProcessing = false
if (processingQueue.value.length > 0) {
setTimeout(processBatch, 0)
}
})
Promise.all(batch.map((tile) => processTileAsync(tile))).then(() => {
isProcessing = false
if (processingQueue.value.length > 0) {
setTimeout(processBatch, 0)
}
})
}
function processTile(tile: Tile) {
@ -82,17 +81,9 @@ export function useTileProcessingComposable() {
if (!data1 || !data2) return false
const colorDifference = Math.sqrt(
Math.pow(data1.color.r - data2.color.r, 2) +
Math.pow(data1.color.g - data2.color.g, 2) +
Math.pow(data1.color.b - data2.color.b, 2)
)
const colorDifference = Math.sqrt(Math.pow(data1.color.r - data2.color.r, 2) + Math.pow(data1.color.g - data2.color.g, 2) + Math.pow(data1.color.b - data2.color.b, 2))
return (
colorDifference <= COLOR_SIMILARITY_THRESHOLD &&
Math.abs(data1.edge - data2.edge) <= EDGE_SIMILARITY_THRESHOLD &&
data1.namePrefix === data2.namePrefix
)
return colorDifference <= COLOR_SIMILARITY_THRESHOLD && Math.abs(data1.edge - data2.edge) <= EDGE_SIMILARITY_THRESHOLD && data1.namePrefix === data2.namePrefix
}
function cleanup() {
@ -104,4 +95,4 @@ export function useTileProcessingComposable() {
areTilesRelated,
cleanup
}
}
}