Skip to content
Snippets Groups Projects
Commit f6e312e6 authored by Sebastian Mohr's avatar Sebastian Mohr
Browse files

Placement of snips using pen too sensitive see #89

parent 8b02cdf4
Branches
Tags
No related merge requests found
Pipeline #565292 passed
...@@ -119,6 +119,9 @@ build:packages:render: ...@@ -119,6 +119,9 @@ build:packages:render:
<<: *pnpm_cache <<: *pnpm_cache
before_script: before_script:
# Install corepack and pnpm # Install corepack and pnpm
- apk add --no-cache curl build-base
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- source $HOME/.cargo/env
- corepack enable - corepack enable
- corepack prepare pnpm@latest-9 --activate - corepack prepare pnpm@latest-9 --activate
- pnpm config set store-dir .pnpm-store - pnpm config set store-dir .pnpm-store
...@@ -126,7 +129,7 @@ build:packages:render: ...@@ -126,7 +129,7 @@ build:packages:render:
script: script:
# Build the package # Build the package
- echo "Building @snip/render" - echo "Building @snip/render"
- pnpm --filter render build - pnpm --filter render... build
# TODO: publish to local registry # TODO: publish to local registry
tags: tags:
- docker - docker
......
...@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Permissions where not resolved correctly, the first found set is used - Permissions where not resolved correctly, the first found set is used
- A minor SSO issue when the user is behind a reverse proxy - A minor SSO issue when the user is behind a reverse proxy
- The redirect url was not correctly set to the server url (without the proxy) - The redirect url was not correctly set to the server url (without the proxy)
- Placement of snips using pen too sensitive as the pen dpi was not correctly detected
## [1.9.2] ## [1.9.2]
### Added ### Added
......
...@@ -3,8 +3,8 @@ import { HTMLAttributes, useCallback, useEffect, useRef } from "react"; ...@@ -3,8 +3,8 @@ import { HTMLAttributes, useCallback, useEffect, useRef } from "react";
export interface DragMoveProps extends HTMLAttributes<HTMLDivElement> { export interface DragMoveProps extends HTMLAttributes<HTMLDivElement> {
onDragMove: ( onDragMove: (
e: PointerEvent, e: PointerEvent,
offset?: [number, number], offset: [number, number],
movement?: [number, number], movement: [number, number],
) => void; ) => void;
} }
...@@ -48,7 +48,7 @@ function useDrag({ ...@@ -48,7 +48,7 @@ function useDrag({
}) { }) {
const offset = useRef<[number, number]>([0, 0]); const offset = useRef<[number, number]>([0, 0]);
const isDragging = useRef(false); const isDragging = useRef(false);
const screenPos = useRef<[number, number]>([0, 0]); const screenPos = useRef<[number, number] | null>(null);
const handlePointerMove = useCallback( const handlePointerMove = useCallback(
(e: PointerEvent) => { (e: PointerEvent) => {
e.preventDefault(); e.preventDefault();
...@@ -60,13 +60,13 @@ function useDrag({ ...@@ -60,13 +60,13 @@ function useDrag({
return; return;
e.preventDefault(); e.preventDefault();
if (isDragging.current) { if (isDragging.current && screenPos.current) {
const movement: [number, number] = [ const movement: [number, number] = [
e.screenX - screenPos.current[0], e.clientX - screenPos.current[0],
e.screenY - screenPos.current[1], e.clientY - screenPos.current[1],
]; ];
onDragMove(e, offset.current, movement); onDragMove(e, offset.current, movement);
screenPos.current = [e.screenX, e.screenY]; screenPos.current = [e.clientX, e.clientY];
} }
}, },
[onDragMove, pointerTypes], [onDragMove, pointerTypes],
......
...@@ -110,10 +110,10 @@ function PlacementOverlay() { ...@@ -110,10 +110,10 @@ function PlacementOverlay() {
<OverlayContent> <OverlayContent>
<DragMove <DragMove
className="w-100 h-100 position-absolute" className="w-100 h-100 position-absolute"
onDragMove={(e) => { onDragMove={(_e, _o, m) => {
move( move(
e.movementX * window.devicePixelRatio, m[0] * window.devicePixelRatio,
e.movementY * window.devicePixelRatio, m[1] * window.devicePixelRatio,
); );
}} }}
></DragMove> ></DragMove>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment