Enlarge crop area
This commit is contained in:
@@ -185,10 +185,9 @@ export function drawRotate(
|
|||||||
tempCtx.restore()
|
tempCtx.restore()
|
||||||
|
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
// canvas.width = 390
|
canvas.width = 640*4 - 510 // -offset right
|
||||||
// canvas.height = 165
|
canvas.height = 540*1.7
|
||||||
canvas.width = 1365
|
// canvas.style.border = "1px solid red"
|
||||||
canvas.height = 576
|
|
||||||
// console.log(ctx.imageSmoothingEnabled, ctx.imageSmoothingQuality)
|
// console.log(ctx.imageSmoothingEnabled, ctx.imageSmoothingQuality)
|
||||||
if (isInterpolated) {
|
if (isInterpolated) {
|
||||||
ctx.imageSmoothingEnabled = true
|
ctx.imageSmoothingEnabled = true
|
||||||
@@ -197,9 +196,9 @@ export function drawRotate(
|
|||||||
ctx.imageSmoothingEnabled = false
|
ctx.imageSmoothingEnabled = false
|
||||||
}
|
}
|
||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.translate(canvas.width/2, canvas.height/2)
|
ctx.translate(canvas.width/2+255, canvas.height/2)
|
||||||
ctx.scale(scale, scale)
|
ctx.scale(scale, scale)
|
||||||
ctx.drawImage(tempCanvas, -tempCanvas.width/2, -tempCanvas.height/2)
|
ctx.drawImage(tempCanvas, -tempCanvas.width/1.5, -tempCanvas.height/1.5)
|
||||||
ctx.restore()
|
ctx.restore()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +207,7 @@ function drawContour(
|
|||||||
ctx: CanvasRenderingContext2D,
|
ctx: CanvasRenderingContext2D,
|
||||||
): void {
|
): void {
|
||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.translate(canvas.width/2 +120, canvas.height/2 -20)
|
ctx.translate(canvas.width/2 -20+255, canvas.height/2 -10)
|
||||||
// TODO create contour image exact scale when sizes will be accepted
|
// TODO create contour image exact scale when sizes will be accepted
|
||||||
const scale = 5.3/3.5
|
const scale = 5.3/3.5
|
||||||
const scaledWidth = latviaBoderImg.width/scale
|
const scaledWidth = latviaBoderImg.width/scale
|
||||||
|
|||||||
@@ -112,12 +112,13 @@ function getAvgDirection(directions: number[][], gridRow: number, gridCol: numbe
|
|||||||
const directionRow = gridRow * cellSize + row;
|
const directionRow = gridRow * cellSize + row;
|
||||||
const directionCol = gridCol * cellSize + col;
|
const directionCol = gridCol * cellSize + col;
|
||||||
|
|
||||||
|
if (directions[directionRow] !== undefined && directions[directionRow][directionCol] !== undefined) {
|
||||||
const directionRad = directions[directionRow][directionCol]
|
const directionRad = directions[directionRow][directionCol]
|
||||||
|
|
||||||
sumSin += Math.sin(directionRad);
|
sumSin += Math.sin(directionRad);
|
||||||
sumCos += Math.cos(directionRad);
|
sumCos += Math.cos(directionRad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compute the average direction
|
// Compute the average direction
|
||||||
const avgDirection = Math.atan2(sumSin, sumCos); // Result is in radians
|
const avgDirection = Math.atan2(sumSin, sumCos); // Result is in radians
|
||||||
|
|||||||
@@ -52,5 +52,6 @@ export type DrawOptions = {
|
|||||||
getIsInterpolated: Accessor<boolean>,
|
getIsInterpolated: Accessor<boolean>,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CROP_BOUNDS = { x: 1906-1-440, y: 895, width: 440, height: 380, angle: 26 }
|
// export const CROP_BOUNDS = { x: 1906-1-440, y: 895, width: 440, height: 380, angle: 26 }
|
||||||
|
export const CROP_BOUNDS = { x: 1906-1-660, y: 840, width: 660, height: 620, angle: 26 }
|
||||||
export type CropBounds = typeof CROP_BOUNDS
|
export type CropBounds = typeof CROP_BOUNDS
|
||||||
|
|||||||
Reference in New Issue
Block a user