Merge pull request #29 from mitchemmc/chore/dependency-updates

Chore/dependency updates
This commit is contained in:
Mitchell McCaffrey 2020-11-19 15:24:24 +11:00 committed by GitHub
commit b214b939df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4119 additions and 3718 deletions

View File

@ -3,41 +3,42 @@
"version": "1.6.2",
"private": true,
"dependencies": {
"@babylonjs/core": "^4.1.0",
"@babylonjs/loaders": "^4.1.0",
"@msgpack/msgpack": "^1.12.1",
"@babylonjs/core": "^4.2.0",
"@babylonjs/loaders": "^4.2.0",
"@msgpack/msgpack": "^2.3.0",
"@sentry/react": "^5.27.1",
"@stripe/stripe-js": "^1.3.2",
"@tensorflow/tfjs": "^2.6.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.0",
"@testing-library/user-event": "^12.2.2",
"ammo.js": "kripken/ammo.js#aab297a4164779c3a9d8dc8d9da26958de3cb778",
"case": "^1.6.3",
"dexie": "^2.0.4",
"fake-indexeddb": "^3.0.0",
"dexie": "^3.0.3",
"err-code": "^2.0.3",
"fake-indexeddb": "^3.1.2",
"fuse.js": "^6.4.1",
"interactjs": "^1.9.7",
"konva": "^6.0.0",
"konva": "^7.1.8",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"normalize-wheel": "^1.0.1",
"polygon-clipping": "^0.14.3",
"raw.macro": "^0.3.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-konva": "^16.13.0-3",
"react-markdown": "^4.3.1",
"polygon-clipping": "^0.15.1",
"raw.macro": "^0.4.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-konva": "^17.0.0-0",
"react-markdown": "^5.0.2",
"react-media": "^2.0.0-rc.1",
"react-modal": "^3.11.2",
"react-resize-detector": "^4.2.3",
"react-resize-detector": "4.2.3",
"react-router-dom": "^5.1.2",
"react-router-hash-link": "^1.2.2",
"react-scripts": "3.4.0",
"react-router-hash-link": "^2.2.2",
"react-scripts": "4.0.0",
"react-select": "^3.1.0",
"react-spring": "^8.0.27",
"react-toast-notifications": "^2.4.0",
"react-use-gesture": "^7.0.15",
"react-use-gesture": "^8.0.1",
"shortid": "^2.2.15",
"simple-peer": "feross/simple-peer#694/head",
"simplebar-react": "^2.1.0",

View File

@ -37,7 +37,7 @@
</style>
</head>
<body>
<img src="404.png" alt="404 bear not found" />
<img src="/404.png" alt="404 bear not found" />
<h4>
Unable to find the page you're looking for try heading back to
<a href="https://owlbear.rodeo">owlbear.rodeo</a>

View File

@ -44,7 +44,7 @@ function MapPointer({
}
function handleBrushMove() {
onPointerMove && onPointerMove(getBrushPosition());
onPointerMove && visible && onPointerMove(getBrushPosition());
}
function handleBrushUp() {

View File

@ -21,131 +21,141 @@ function useStageInteraction(
const pinchPreviousDistanceRef = useRef();
const pinchPreviousOriginRef = useRef();
const bind = useGesture({
...gesture,
onWheelStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
gesture.onWheelStart && gesture.onWheelStart(props);
},
onWheel: (props) => {
const { event } = props;
event.persist();
const { pixelY } = normalizeWheel(event);
if (preventInteraction || !isInteractingWithCanvas.current) {
return;
}
const newScale = Math.min(
Math.max(
stageScale +
(pixelY * wheelZoomSpeed * stageScale) / window.innerHeight,
minZoom
),
maxZoom
);
const bind = useGesture(
{
...gesture,
onWheelStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
gesture.onWheelStart && gesture.onWheelStart(props);
},
onWheel: (props) => {
const { event } = props;
event.persist();
const { pixelY } = normalizeWheel(event);
if (preventInteraction || !isInteractingWithCanvas.current) {
return;
}
const newScale = Math.min(
Math.max(
stageScale +
(pixelY * wheelZoomSpeed * stageScale) / window.innerHeight,
minZoom
),
maxZoom
);
// Center on pointer
const pointer = stage.getPointerPosition();
const newTranslate = {
x: pointer.x - ((pointer.x - stage.x()) / stageScale) * newScale,
y: pointer.y - ((pointer.y - stage.y()) / stageScale) * newScale,
};
stage.position(newTranslate);
stageTranslateRef.current = newTranslate;
onStageScaleChange(newScale);
gesture.onWheel && gesture.onWheel(props);
},
onPinchStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
const { da, origin } = props;
const [distance] = da;
const [originX, originY] = origin;
pinchPreviousDistanceRef.current = distance;
pinchPreviousOriginRef.current = { x: originX, y: originY };
gesture.onPinchStart && gesture.onPinchStart(props);
},
onPinch: (props) => {
if (preventInteraction || !isInteractingWithCanvas.current) {
return;
}
const { da, origin } = props;
const [distance] = da;
const [originX, originY] = origin;
// Apply scale
const distanceDelta = distance - pinchPreviousDistanceRef.current;
const originXDelta = originX - pinchPreviousOriginRef.current.x;
const originYDelta = originY - pinchPreviousOriginRef.current.y;
const newScale = Math.min(
Math.max(
stageScale + distanceDelta * touchZoomSpeed * stageScale,
minZoom
),
maxZoom
);
const canvasRect = layer.getCanvas()._canvas.getBoundingClientRect();
const relativeOrigin = {
x: originX - canvasRect.left,
y: originY - canvasRect.top,
};
// Center on pinch origin
const centeredTranslate = {
x:
relativeOrigin.x -
((relativeOrigin.x - stage.x()) / stageScale) * newScale,
y:
relativeOrigin.y -
((relativeOrigin.y - stage.y()) / stageScale) * newScale,
};
// Add pinch movement
const newTranslate = {
x: centeredTranslate.x + originXDelta,
y: centeredTranslate.y + originYDelta,
};
stage.position(newTranslate);
stageTranslateRef.current = newTranslate;
onStageScaleChange(newScale);
pinchPreviousDistanceRef.current = distance;
pinchPreviousOriginRef.current = { x: originX, y: originY };
gesture.onPinch && gesture.onPinch(props);
},
onDragStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
gesture.onDragStart && gesture.onDragStart(props);
},
onDrag: (props) => {
const { delta, pinching } = props;
if (preventInteraction || pinching || !isInteractingWithCanvas.current) {
return;
}
const [dx, dy] = delta;
const stageTranslate = stageTranslateRef.current;
if (tool === "pan") {
// Center on pointer
const pointer = stage.getPointerPosition();
const newTranslate = {
x: stageTranslate.x + dx,
y: stageTranslate.y + dy,
x: pointer.x - ((pointer.x - stage.x()) / stageScale) * newScale,
y: pointer.y - ((pointer.y - stage.y()) / stageScale) * newScale,
};
stage.position(newTranslate);
stage.draw();
stageTranslateRef.current = newTranslate;
}
gesture.onDrag && gesture.onDrag(props);
onStageScaleChange(newScale);
gesture.onWheel && gesture.onWheel(props);
},
onPinchStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
const { da, origin } = props;
const [distance] = da;
const [originX, originY] = origin;
pinchPreviousDistanceRef.current = distance;
pinchPreviousOriginRef.current = { x: originX, y: originY };
gesture.onPinchStart && gesture.onPinchStart(props);
},
onPinch: (props) => {
if (preventInteraction || !isInteractingWithCanvas.current) {
return;
}
const { da, origin } = props;
const [distance] = da;
const [originX, originY] = origin;
// Apply scale
const distanceDelta = distance - pinchPreviousDistanceRef.current;
const originXDelta = originX - pinchPreviousOriginRef.current.x;
const originYDelta = originY - pinchPreviousOriginRef.current.y;
const newScale = Math.min(
Math.max(
stageScale + distanceDelta * touchZoomSpeed * stageScale,
minZoom
),
maxZoom
);
const canvasRect = layer.getCanvas()._canvas.getBoundingClientRect();
const relativeOrigin = {
x: originX - canvasRect.left,
y: originY - canvasRect.top,
};
// Center on pinch origin
const centeredTranslate = {
x:
relativeOrigin.x -
((relativeOrigin.x - stage.x()) / stageScale) * newScale,
y:
relativeOrigin.y -
((relativeOrigin.y - stage.y()) / stageScale) * newScale,
};
// Add pinch movement
const newTranslate = {
x: centeredTranslate.x + originXDelta,
y: centeredTranslate.y + originYDelta,
};
stage.position(newTranslate);
stageTranslateRef.current = newTranslate;
onStageScaleChange(newScale);
pinchPreviousDistanceRef.current = distance;
pinchPreviousOriginRef.current = { x: originX, y: originY };
gesture.onPinch && gesture.onPinch(props);
},
onDragStart: (props) => {
const { event } = props;
isInteractingWithCanvas.current =
event.target === layer.getCanvas()._canvas;
gesture.onDragStart && gesture.onDragStart(props);
},
onDrag: (props) => {
const { delta, pinching } = props;
if (
preventInteraction ||
pinching ||
!isInteractingWithCanvas.current
) {
return;
}
const [dx, dy] = delta;
const stageTranslate = stageTranslateRef.current;
if (tool === "pan") {
const newTranslate = {
x: stageTranslate.x + dx,
y: stageTranslate.y + dy,
};
stage.position(newTranslate);
stage.draw();
stageTranslateRef.current = newTranslate;
}
gesture.onDrag && gesture.onDrag(props);
},
},
});
{
// Fix drawing using old pointer end position on touch devices when drawing new shapes
drag: { delay: 300 },
}
);
return bind;
}

7546
yarn.lock

File diff suppressed because it is too large Load Diff