Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwod committed Aug 29, 2024
2 parents 902ea87 + 084da32 commit f8a4d52
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 25 deletions.
6 changes: 3 additions & 3 deletions apps/admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hajk-admin",
"version": "3.13.25",
"version": "3.14.0",
"description": "Hajk Admin UI",
"homepage": ".",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hajk-backend",
"version": "3.13.25",
"version": "3.14.0",
"description": "Hajk Backend",
"homepage": ".",
"repository": {
Expand Down Expand Up @@ -54,4 +54,4 @@
"supertest": "^6.3.4"
},
"author": "Jacob Wodzyński <[email protected]> (https://github.com/hajkmap)"
}
}
6 changes: 3 additions & 3 deletions apps/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hajk-client",
"version": "3.13.25",
"version": "3.14.0",
"description": "Hajk Client UI",
"homepage": ".",
"repository": {
Expand Down
8 changes: 7 additions & 1 deletion apps/client/src/models/DrawModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,13 @@ class DrawModel {
featureCopy.setId(Math.random().toString(36).substring(2, 15));
// Then we'll set some draw-properties from the original feature.
featureCopy.set("USER_DRAWN", true);
featureCopy.set("DRAW_METHOD", feature.get("DRAW_METHOD"));
// Here we'll add DRAW_METHOD. DRAW_METHOD can be missing from the original feature.
// This can and will happen if you click on an existing feature witch hasn't been drawn.
// So let's set it to the geometry type of the original feature if it's missing.
featureCopy.set(
"DRAW_METHOD",
feature.get("DRAW_METHOD") || feature.getGeometry().getType()
);
featureCopy.set("TEXT_SETTINGS", feature.get("TEXT_SETTINGS"));
// We're gonna need to set some styling on the feature as-well. Let's use the same
// styling as on the supplied feature.
Expand Down
21 changes: 12 additions & 9 deletions apps/client/src/plugins/DocumentHandler/printMenu/PrintWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,18 @@ class PrintWindow extends React.PureComponent {
// Add our recently-created DIV to the new window's document
newWindow.document.body.appendChild(printContent);

// Invoke browser's print dialog - this will block the thread
// until user does something with it.
newWindow.print();

// Once the print dialog has disappeared, let's close the new window
newWindow.close();

// When the user closes the print-window we have to do some cleanup...
this.handlePrintCompleted();
// We force print to the next upcoming render. Let it render in peace.
setTimeout(() => {
// Invoke browser's print dialog - this will block the thread
// until user does something with it.
newWindow.print();

// Once the print dialog has disappeared, let's close the new window
newWindow.close();

// When the user closes the print-window we have to do some cleanup...
this.handlePrintCompleted();
}, 25);
});
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ export default function FeatureStyleSelector(props) {
{props.activeDrawType === "Point" && renderPointStyleSettings()}
{props.activityId === "ADD" &&
props.activeDrawType !== "Circle" &&
props.activeDrawType !== "Text" &&
props.activeDrawType !== "Arrow" &&
renderBufferStyleSettings()}
</Grid>
</Grid>
Expand Down
7 changes: 6 additions & 1 deletion apps/client/src/plugins/Sketch/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ export const DRAW_TYPES = [
},
];

export const ROTATABLE_DRAW_TYPES = ["Polygon", "Rectangle", "LineString"];
export const ROTATABLE_DRAW_TYPES = [
"Polygon",
"MultiPolygon",
"Rectangle",
"LineString",
];

export const MAX_REMOVED_FEATURES = 4;
export const PLUGIN_MARGIN = 10;
Expand Down
25 changes: 24 additions & 1 deletion apps/client/src/plugins/Sketch/views/MoveView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import HajkToolTip from "components/HajkToolTip";
import RotateRightIcon from "@mui/icons-material/RotateRight";
import RotateLeftIcon from "@mui/icons-material/RotateLeft";
import Information from "../components/Information";
import { ROTATABLE_DRAW_TYPES } from "plugins/Sketch/constants";

const TranslateToggler = ({ translateEnabled, setTranslateEnabled }) => {
return (
Expand Down Expand Up @@ -185,7 +186,14 @@ const FeatureRotateSelector = (props) => {
};

return (
<Paper sx={{ p: 1, mt: 1 }}>
<Paper
sx={{
p: 1,
mt: 1,
opacity: props.disabled ? 0.3 : 1.0,
pointerEvents: props.disabled ? "none" : "auto",
}}
>
<Grid container item justifyContent="center" alignItems="center">
<Grid item xs={12} sx={{ mb: 1 }}>
<Typography variant="body2" align="center">
Expand All @@ -208,6 +216,7 @@ const FeatureRotateSelector = (props) => {
</Grid>
<Grid item xs={3} sx={{ pr: 1 / 4 }}>
<Button
disabled={props.disabled}
variant="contained"
fullWidth
size="small"
Expand All @@ -224,6 +233,7 @@ const FeatureRotateSelector = (props) => {
</Grid>
<Grid item xs={3} sx={{ pl: 1 / 4 }}>
<Button
disabled={props.disabled}
variant="contained"
fullWidth
size="small"
Expand Down Expand Up @@ -264,6 +274,18 @@ const MoveView = (props) => {
setLastMoves([]);
}, [moveFeatures]);

const rotationIsDisabled = () => {
// Rotation is only allowed for specific draw methods.

let drawMethod = moveFeatures[0].get("DRAW_METHOD");

if (drawMethod) {
return ROTATABLE_DRAW_TYPES.indexOf(drawMethod) === -1;
}

return false;
};

// We have to get some information about the current activity (view)
const activity = props.model.getActivityFromId(props.id);
return (
Expand All @@ -288,6 +310,7 @@ const MoveView = (props) => {
setMovementAngle={setMovementAngle}
/>
<FeatureRotateSelector
disabled={rotationIsDisabled()}
drawModel={drawModel}
rotationDegrees={rotationDegrees}
setRotationDegrees={setRotationDegrees}
Expand Down

0 comments on commit f8a4d52

Please sign in to comment.