code format

This commit is contained in:
Zutatensuppe 2020-11-08 12:58:21 +01:00
parent 1f3eb41b4e
commit 55dde8b646

View file

@ -64,7 +64,7 @@ function fillBitmapCapped(bitmap, rgba, rects_cap) {
}
}
function mapBitmapToBitmap (
function mapBitmapToBitmap(
/** @type {Bitmap} */src,
/** @type {BoundingRectangle} */ rect_src,
/** @type {Bitmap} */ dst,
@ -93,7 +93,7 @@ function mapBitmapToBitmap (
}
}
function mapBitmapToBitmapCapped (
function mapBitmapToBitmapCapped(
/** @type {Bitmap} */ src,
/** @type {BoundingRectangle} */ rect_src,
/** @type {Bitmap} */ dst,
@ -163,7 +163,7 @@ function mapBitmapToAdapterCapped (
}
}
function mapBitmapToAdapter (
function mapBitmapToAdapter(
/** @type {Bitmap} */ src,
/** @type {BoundingRectangle} */ rect_src,
/** @type {CanvasAdapter} */ dst,
@ -253,10 +253,10 @@ const determinePuzzleInfo = (w, h, targetTiles) => {
tileSize = TILE_SIZE
const width = tiles_x * tileSize
const height = tiles_y * tileSize
const coords = coordsByNum({width, height, tileSize, tiles})
const coords = coordsByNum({ width, height, tileSize, tiles })
const tileMarginWidth = tileSize * .5;
const tileDrawSize = Math.round(tileSize + tileMarginWidth*2)
const tileDrawSize = Math.round(tileSize + tileMarginWidth * 2)
return {
width,
@ -311,22 +311,22 @@ function getSurroundingTilesByIdx(puzzle, idx) {
]
}
function determinePuzzleTileShapes (info) {
function determinePuzzleTileShapes(info) {
const tabs = [-1, 1]
const shapes = new Array(info.tiles)
for (let i = 0; i < info.tiles; i++) {
shapes[i] = {
top: info.coords[i].y === 0 ? 0 : shapes[i - info.tiles_x].bottom * -1,
right: info.coords[i].x === info.tiles_x -1 ? 0 : choice(tabs),
right: info.coords[i].x === info.tiles_x - 1 ? 0 : choice(tabs),
left: info.coords[i].x === 0 ? 0 : shapes[i - 1].right * -1,
bottom: info.coords[i].y === info.tiles_y -1 ? 0 : choice(tabs),
bottom: info.coords[i].y === info.tiles_y - 1 ? 0 : choice(tabs),
}
}
return shapes
}
async function createPuzzleTileBitmaps (bitmap, tiles, info) {
async function createPuzzleTileBitmaps(bitmap, tiles, info) {
let img = await bitmap.toImage()
var tileSize = info.tileSize
var tileMarginWidth = info.tileMarginWidth
@ -423,7 +423,7 @@ async function createPuzzleTileBitmaps (bitmap, tiles, info) {
return bitmaps
}
function srcRectByIdx (puzzleInfo, idx) {
function srcRectByIdx(puzzleInfo, idx) {
let c = puzzleInfo.coords[idx]
let cx = c.x * puzzleInfo.tileSize
let cy = c.y * puzzleInfo.tileSize
@ -435,7 +435,7 @@ function srcRectByIdx (puzzleInfo, idx) {
)
}
const pointSub = (a, b) => ({x: a.x - b.x, y: a.y - b.y})
const pointSub = (a, b) => ({ x: a.x - b.x, y: a.y - b.y })
const pointAdd = (a, b) => ({x: a.x + b.x, y: a.y + b.y})