forked from noxious/client
npm run format
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user