Merge branch 'master' into release/v1.7.0
This commit is contained in:
commit
c338af5557
@ -136,10 +136,7 @@ function MapDrawing({
|
|||||||
onShapeAdd(drawingShape);
|
onShapeAdd(drawingShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (erasingShapes.length > 0) {
|
eraseHoveredShapes();
|
||||||
onShapesRemove(erasingShapes.map((shape) => shape.id));
|
|
||||||
setErasingShapes([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
setDrawingShape(null);
|
setDrawingShape(null);
|
||||||
setIsBrushDown(false);
|
setIsBrushDown(false);
|
||||||
@ -164,6 +161,13 @@ function MapDrawing({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eraseHoveredShapes() {
|
||||||
|
if (erasingShapes.length > 0) {
|
||||||
|
onShapesRemove(erasingShapes.map((shape) => shape.id));
|
||||||
|
setErasingShapes([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function renderShape(shape) {
|
function renderShape(shape) {
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
key: shape.id,
|
key: shape.id,
|
||||||
@ -171,6 +175,8 @@ function MapDrawing({
|
|||||||
onTouchOver: () => handleShapeOver(shape, isBrushDown),
|
onTouchOver: () => handleShapeOver(shape, isBrushDown),
|
||||||
onMouseDown: () => handleShapeOver(shape, true),
|
onMouseDown: () => handleShapeOver(shape, true),
|
||||||
onTouchStart: () => handleShapeOver(shape, true),
|
onTouchStart: () => handleShapeOver(shape, true),
|
||||||
|
onMouseUp: eraseHoveredShapes,
|
||||||
|
onTouchEnd: eraseHoveredShapes,
|
||||||
fill: colors[shape.color] || shape.color,
|
fill: colors[shape.color] || shape.color,
|
||||||
opacity: shape.blend ? 0.5 : 1,
|
opacity: shape.blend ? 0.5 : 1,
|
||||||
id: shape.id,
|
id: shape.id,
|
||||||
|
@ -143,20 +143,7 @@ function MapFog({
|
|||||||
setDrawingShape(null);
|
setDrawingShape(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Erase
|
eraseHoveredShapes();
|
||||||
if (editingShapes.length > 0) {
|
|
||||||
if (toolSettings.type === "remove") {
|
|
||||||
onShapesRemove(editingShapes.map((shape) => shape.id));
|
|
||||||
} else if (toolSettings.type === "toggle") {
|
|
||||||
onShapesEdit(
|
|
||||||
editingShapes.map((shape) => ({
|
|
||||||
...shape,
|
|
||||||
visible: !shape.visible,
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
setEditingShapes([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsBrushDown(false);
|
setIsBrushDown(false);
|
||||||
}
|
}
|
||||||
@ -280,6 +267,23 @@ function MapFog({
|
|||||||
|
|
||||||
useKeyboard(handleKeyDown, handleKeyUp);
|
useKeyboard(handleKeyDown, handleKeyUp);
|
||||||
|
|
||||||
|
function eraseHoveredShapes() {
|
||||||
|
// Erase
|
||||||
|
if (editingShapes.length > 0) {
|
||||||
|
if (toolSettings.type === "remove") {
|
||||||
|
onShapesRemove(editingShapes.map((shape) => shape.id));
|
||||||
|
} else if (toolSettings.type === "toggle") {
|
||||||
|
onShapesEdit(
|
||||||
|
editingShapes.map((shape) => ({
|
||||||
|
...shape,
|
||||||
|
visible: !shape.visible,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setEditingShapes([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleShapeOver(shape, isDown) {
|
function handleShapeOver(shape, isDown) {
|
||||||
if (shouldHover && isDown) {
|
if (shouldHover && isDown) {
|
||||||
if (editingShapes.findIndex((s) => s.id === shape.id) === -1) {
|
if (editingShapes.findIndex((s) => s.id === shape.id) === -1) {
|
||||||
@ -304,6 +308,8 @@ function MapFog({
|
|||||||
onTouchOver={() => handleShapeOver(shape, isBrushDown)}
|
onTouchOver={() => handleShapeOver(shape, isBrushDown)}
|
||||||
onMouseDown={() => handleShapeOver(shape, true)}
|
onMouseDown={() => handleShapeOver(shape, true)}
|
||||||
onTouchStart={() => handleShapeOver(shape, true)}
|
onTouchStart={() => handleShapeOver(shape, true)}
|
||||||
|
onMouseUp={eraseHoveredShapes}
|
||||||
|
onTouchEnd={eraseHoveredShapes}
|
||||||
points={points}
|
points={points}
|
||||||
stroke={colors[shape.color] || shape.color}
|
stroke={colors[shape.color] || shape.color}
|
||||||
fill={colors[shape.color] || shape.color}
|
fill={colors[shape.color] || shape.color}
|
||||||
|
@ -26,7 +26,7 @@ import filteringMaps from "./FilteringMaps.mp4";
|
|||||||
import groupAndRemovingTokens from "./GroupAndRemovingTokens.mp4";
|
import groupAndRemovingTokens from "./GroupAndRemovingTokens.mp4";
|
||||||
import filteringTokens from "./FilteringTokens.mp4";
|
import filteringTokens from "./FilteringTokens.mp4";
|
||||||
|
|
||||||
export default {
|
const assets = {
|
||||||
defaultMaps,
|
defaultMaps,
|
||||||
customMaps,
|
customMaps,
|
||||||
editingMapsAdvanced,
|
editingMapsAdvanced,
|
||||||
@ -55,3 +55,5 @@ export default {
|
|||||||
groupAndRemovingTokens,
|
groupAndRemovingTokens,
|
||||||
filteringTokens,
|
filteringTokens,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default assets;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default {
|
const theme = {
|
||||||
colors: {
|
colors: {
|
||||||
text: "hsl(210, 50%, 96%)",
|
text: "hsl(210, 50%, 96%)",
|
||||||
background: "hsl(230, 25%, 18%)",
|
background: "hsl(230, 25%, 18%)",
|
||||||
@ -281,3 +281,5 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default theme;
|
||||||
|
Loading…
Reference in New Issue
Block a user