feat(ui): minor fixes

This commit is contained in:
max_richter 2021-03-13 01:32:41 +01:00
parent dd2e476065
commit 6f0395798a
10 changed files with 68 additions and 23 deletions

View File

@ -37,6 +37,13 @@ input, button, select, textarea {
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 2px; border-radius: 2px;
background-color: #000000;
outline: none;
color: white;
cursor: pointer;
border: none;
padding: 4px 9px;
border-radius: 0px;
} }
input:disabled { input:disabled {
@ -44,7 +51,6 @@ input:disabled {
} }
button { button {
background-color: #f4f4f4;
outline: none; outline: none;
cursor: pointer; cursor: pointer;
} }

View File

@ -44,7 +44,7 @@
) / 100}% ) / 100}%
</p> </p>
<div <div
transition:scaleX={{ duration: 500, delay: i * 200 }} in:scaleX={{ duration: 500, delay: i * 200 }}
class="bar" class="bar"
style={`width: ${ style={`width: ${
(correctDistortion ? color.value : color.distortedValue) * 100 (correctDistortion ? color.value : color.distortedValue) * 100

View File

@ -39,7 +39,7 @@
overflow: hidden; overflow: hidden;
display: grid; display: grid;
height: 100%; height: 100%;
grid-template-columns: 50px 1fr; grid-template-columns: 75px 1fr;
grid-template-rows: 30px 1fr 30px; grid-template-rows: 30px 1fr 30px;
gap: 0px 0px; gap: 0px 0px;
grid-template-areas: grid-template-areas:

View File

@ -2,7 +2,6 @@ import { Renderer, Camera, Transform, Texture, Raycast, Sphere, Program, Mesh }
import { Orbit } from "./CustomOrbit" import { Orbit } from "./CustomOrbit"
import { bufToImageUrl } from "../../helpers"; import { bufToImageUrl } from "../../helpers";
import VertexShader from "./Orb.vert"; import VertexShader from "./Orb.vert";
import FragmentShader from "./Orb.frag"; import FragmentShader from "./Orb.frag";
import Toast from "../Toast"; import Toast from "../Toast";
@ -21,7 +20,9 @@ export default (image: Image, canvas2D: CanvasRenderingContext2D, canvas3D: HTML
const controls = new Orbit(camera, { const controls = new Orbit(camera, {
enablePan: false, enablePan: false,
enableZoom: false, enableZoom: false,
rotateSpeed: -0.1 rotateSpeed: -0.5,
ease: 0,
inertia: 0,
}); });
function resize() { function resize() {
@ -107,7 +108,7 @@ export default (image: Image, canvas2D: CanvasRenderingContext2D, canvas3D: HTML
function start() { function start() {
!hasConfirmed && Toast.confirm("Drawing does not work correctly in 3D at the moment").then(c => { !hasConfirmed && Toast.confirm("Drawing does not work correctly in 3D at the moment").then(c => {
hasConfirmed = c; hasConfirmed = c === true;
}) })
if (shouldBeRendering) return; if (shouldBeRendering) return;

View File

@ -111,8 +111,6 @@
cx.arc(x, y, brushRadius * wrapperHeightRatio, 0, 2 * Math.PI); cx.arc(x, y, brushRadius * wrapperHeightRatio, 0, 2 * Math.PI);
cx.fill(); cx.fill();
cx.closePath(); cx.closePath();
orb.updateOverlay();
} }
let polygonPoints = []; let polygonPoints = [];
@ -158,7 +156,12 @@
e.preventDefault(); e.preventDefault();
mode = mode === "2d" ? "3d" : "2d"; mode = mode === "2d" ? "3d" : "2d";
orb.updateOverlay();
if (mode === "3d") {
if (!orb) orb = OrbView(image, cx1, canvas3D);
orb.updateOverlay();
}
mode === "2d" ? orb.stop() : orb.start(); mode === "2d" ? orb.stop() : orb.start();
} }
@ -323,8 +326,6 @@
handleResize(); handleResize();
orb = OrbView(image, cx1, canvas3D);
setTimeout(() => handleResize(), 500); setTimeout(() => handleResize(), 500);
setTimeout(() => handleResize(), 2000); setTimeout(() => handleResize(), 2000);
}); });

View File

@ -1,6 +1,12 @@
<script>
export let w = 80;
export let color = "black";
export let weight = 1;
</script>
<svg <svg
width="82" width={w}
height="82" height={w}
viewBox="0 0 82 82" viewBox="0 0 82 82"
fill="none" fill="none"
style="height: 100%;" style="height: 100%;"
@ -8,7 +14,8 @@
> >
<path <path
d="M41 0V81.5M81.75 40.75L0.25 40.75" d="M41 0V81.5M81.75 40.75L0.25 40.75"
stroke="black" stroke={color}
stroke-width="0.75px" vector-effect="non-scaling-stroke"
stroke-width="{weight}px"
/> />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 375 B

View File

@ -0,0 +1,21 @@
<script>
export let w = 80;
export let color = "black";
export let weight = 1;
</script>
<svg
width={w}
height={w}
viewBox="0 0 82 82"
fill="none"
style="height: 100%;"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M41 0V81.5M81.75 40.75L0.25 40.75"
stroke={color}
vector-effect="non-scaling-stroke"
stroke-width="{weight}px"
/>
</svg>

View File

@ -1 +1,2 @@
export { default as Cross } from "./Cross.svelte" export { default as Cross } from "./Cross.svelte"
export { default as Plus } from "./Plus.svelte"

View File

@ -95,30 +95,33 @@
{/each} {/each}
<div id="cross-wrapper" on:click={() => route.set("main")}> <div id="cross-wrapper" on:click={() => route.set("main")}>
<Cross /> <Cross w={20} color="white" weight={2} />
<p>Add more images</p> <p>Add more images</p>
</div> </div>
</main> </main>
<style> <style>
#cross-wrapper { #cross-wrapper {
margin-top: 40px; margin-top: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: black;
padding: 10px;
width: fit-content;
cursor: pointer;
} }
#cross-wrapper > p { #cross-wrapper > p {
margin: 0;
color: white;
margin-left: 10px; margin-left: 10px;
} }
main { main {
height: 100%;
max-width: 640px; max-width: 640px;
margin: 0 auto; margin: 0 auto;
} }
@media (max-width: 640px) { h4 {
main { margin: 10px 0px;
max-width: none;
}
} }
.list-item { .list-item {

View File

@ -117,6 +117,11 @@
align-items: center; align-items: center;
padding: 20px; padding: 20px;
outline: solid thin black; outline: solid thin black;
cursor: pointer;
}
.inner-wrapper:hover {
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
} }
p { p {