Merge branch 'master' into release/v1.7.0

This commit is contained in:
Mitchell McCaffrey
2020-11-20 09:40:43 +11:00
4 changed files with 36 additions and 20 deletions

View File

@@ -136,10 +136,7 @@ function MapDrawing({
onShapeAdd(drawingShape);
}
if (erasingShapes.length > 0) {
onShapesRemove(erasingShapes.map((shape) => shape.id));
setErasingShapes([]);
}
eraseHoveredShapes();
setDrawingShape(null);
setIsBrushDown(false);
@@ -164,6 +161,13 @@ function MapDrawing({
}
}
function eraseHoveredShapes() {
if (erasingShapes.length > 0) {
onShapesRemove(erasingShapes.map((shape) => shape.id));
setErasingShapes([]);
}
}
function renderShape(shape) {
const defaultProps = {
key: shape.id,
@@ -171,6 +175,8 @@ function MapDrawing({
onTouchOver: () => handleShapeOver(shape, isBrushDown),
onMouseDown: () => handleShapeOver(shape, true),
onTouchStart: () => handleShapeOver(shape, true),
onMouseUp: eraseHoveredShapes,
onTouchEnd: eraseHoveredShapes,
fill: colors[shape.color] || shape.color,
opacity: shape.blend ? 0.5 : 1,
id: shape.id,