fix: implement simple distortion fix
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Renderer, Camera, Transform, Texture, Sphere, Program, Mesh } from "ogl"
|
||||
import { Orbit } from "./CustomOrbit"
|
||||
import { bufToImageUrl } from "helpers";
|
||||
import { bufToImageUrl } from "../../helpers";
|
||||
|
||||
|
||||
import VertexShader from "./Orb.vert";
|
||||
|
@ -46,6 +46,7 @@
|
||||
let downX, downOffset;
|
||||
|
||||
let debugValue = 0;
|
||||
let debugY = 0;
|
||||
|
||||
let isStrPressed = false;
|
||||
let isSpacePressed = false;
|
||||
@ -155,14 +156,11 @@
|
||||
isOriginal = e.target.id === "cx1";
|
||||
|
||||
//Caclulate y position of pixel
|
||||
const y = my / wrapperHeightRatio;
|
||||
const y = Math.floor(my * wrapperHeightRatio);
|
||||
debugY = y;
|
||||
|
||||
// KarlKilian Formel
|
||||
debugValue = Math.cos(
|
||||
(360 / Math.pow(image.height, 2)) * Math.pow(y, 2) +
|
||||
(-360 / image.height) * y +
|
||||
90
|
||||
);
|
||||
debugValue = (2 * Math.sqrt(y * (image.height - y))) / image.height;
|
||||
|
||||
if (isDown) {
|
||||
if (activeTool === "pan") {
|
||||
@ -303,7 +301,7 @@
|
||||
}%)); opacity: ${(layerOpacity / 100) * 0.5};`}
|
||||
/>
|
||||
|
||||
<p>{debugValue}|{my}</p>
|
||||
<p>h:{image.height} | y:{debugY} | value:{debugValue}</p>
|
||||
|
||||
<canvas class:visible={mode === "3d"} bind:this={canvas3D} />
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user