Skip to content

Commit

Permalink
馃殌 perf(app): optimize konva rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
gerdesque committed Feb 23, 2024
1 parent 4b3cff0 commit fecc1c9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<link rel="mask-icon" href="/maskable-icon-512x512.png" color="#FFFFFF">
<meta name="theme-color" content="#BC13FE">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="description" content="Wir machen Kulturerbe digital erfahrbar.">
<title>GLAMorous Europe</title>
<link rel="icon" type="image/png" sizes="196x196" href="/favicon-196.png">
Expand Down
1 change: 1 addition & 0 deletions src/components/ArtworkCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ const ArtworkCanvas: React.FC = () => {
border: "4px solid",
borderColor: borderColor,
}}
pixelRatio={1}
width={sceneWidth}
height={sceneHeight}
ref={stageRef}
Expand Down
1 change: 1 addition & 0 deletions src/components/ArtworkImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const ArtworkImage = ({
onTap={onSelect}
onTransformEnd={handleTransformEnd}
opacity={canvasImage.opacity || 1}
perfectDrawEnabled={false}
ref={imageRef}
scaleX={0.5}
scaleY={0.5}
Expand Down
7 changes: 3 additions & 4 deletions src/components/ArtworkThumbnail.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CSSProperties } from "react";
import { DragPreviewImage, useDrag } from "react-dnd";
import { useDrag } from "react-dnd";
import { Preview } from "react-dnd-multi-backend";

function ArtworkThumbnail({ id, image }: { id: string; image: string }) {
const [{ opacity }, drag, preview] = useDrag(() => ({
const [{ opacity }, drag] = useDrag(() => ({
type: "artwork",
item: { id, image },
collect: (monitor) => ({
Expand Down Expand Up @@ -35,15 +35,14 @@ function ArtworkThumbnail({ id, image }: { id: string; image: string }) {

return (
<>
<DragPreviewImage connect={preview} src={image} />
<Preview>{generatePreview}</Preview>
<img
src={image}
alt={id}
role="presentation"
style={{
cursor: "move",
marginRight: "10px",
paddingRight: "10px",
maxHeight: "100px",
opacity: opacity,
scrollSnapAlign: "start",
Expand Down
1 change: 1 addition & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const HTML5toTouch = {
{
id: "html5",
backend: HTML5Backend,
preview: true,
transition: MouseTransition,
},
{
Expand Down

0 comments on commit fecc1c9

Please sign in to comment.