Skip to content

Commit 0fefbf1

Browse files
committed
11.2
1 parent 1760b77 commit 0fefbf1

18 files changed

+80
-221
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ keys
1616
test/cypress/screenshotsFolder
1717
test/cypress/snapshots/**/__diff_output__/*
1818
.idea
19+
storybook-static

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webviewer-ui",
33
"author": "Apryse Software Inc.",
4-
"version": "11.3.0",
4+
"version": "11.2.0",
55
"description": "WebViewer UI built in React",
66
"main": "src/index.js",
77
"scripts": {
@@ -144,4 +144,4 @@
144144
"lint-staged": {
145145
"./src/**/*.{js,ts}": "eslint --fix"
146146
}
147-
}
147+
}

src/components/MeasurementOverlay/EllipseMeasurementOverlay.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ const propTypes = {
5454
return null;
5555
},
5656
isOpen: PropTypes.bool.isRequired,
57-
canModify: PropTypes.bool,
5857
};
5958

60-
function EllipseMeasurementOverlay({ annotation, isOpen, selectedTool, canModify }) {
59+
function EllipseMeasurementOverlay({ annotation, isOpen, selectedTool }) {
6160
const { t } = useTranslation();
6261

6362
const isReadOnly = useSelector((state) => selectors.isDocumentReadOnly(state));
@@ -236,7 +235,7 @@ function EllipseMeasurementOverlay({ annotation, isOpen, selectedTool, canModify
236235
className="scale-input"
237236
type="number"
238237
min="0"
239-
disabled={isReadOnly || !annotation || !canModify}
238+
disabled={isReadOnly || !annotation}
240239
value={radius}
241240
onChange={(event) => {
242241
onChangeRadiusLength(event);

src/components/MeasurementOverlay/LineMeasurementInput.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ LineMeasurementInput.propTypes = {
1717
annotation: PropTypes.object,
1818
isOpen: PropTypes.bool.isRequired,
1919
selectedTool: PropTypes.object,
20-
canModify: PropTypes.bool,
2120
};
2221

2322
const Scale = window.Core.Scale;
2423

25-
function LineMeasurementInput({ annotation, isOpen, selectedTool, canModify }) {
24+
function LineMeasurementInput({ annotation, isOpen, selectedTool }) {
2625
const [t] = useTranslation();
2726
const isReadOnly = useSelector((state) => selectors.isDocumentReadOnly(state));
2827
const factor = annotation?.Measure.axis[0].factor;
@@ -213,7 +212,7 @@ function LineMeasurementInput({ annotation, isOpen, selectedTool, canModify }) {
213212
className="scale-input"
214213
type="number"
215214
min="0"
216-
disabled={isReadOnly || !annotation || !canModify}
215+
disabled={isReadOnly || !annotation}
217216
value={!annotation ? 0 : length}
218217
autoFocus={!isMobileDevice}
219218
onChange={(event) => {
@@ -239,7 +238,7 @@ function LineMeasurementInput({ annotation, isOpen, selectedTool, canModify }) {
239238
type="number"
240239
min="0"
241240
max="360"
242-
disabled={isReadOnly || !annotation || !canModify}
241+
disabled={isReadOnly || !annotation}
243242
value={angle}
244243
autoFocus={!isMobileDevice}
245244
onChange={(event) => {

src/components/ModularComponents/Flyout/Flyout.stories.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { createTemplate } from 'helpers/storybookHelper';
1010
import { userEvent, within, expect } from '@storybook/test';
1111
import { uiWithFlyout } from '../storyModularUIConfigs';
1212
import { fireEvent } from '@testing-library/react';
13-
import createItemsForBookmarkOutlineFlyout from 'src/helpers/createItemsForBookmarkOutlineFlyout';
14-
import { menuItems as MenuItemsForBookmarkOutlines, menuTypes } from 'src/components/MoreOptionsContextMenuFlyout/MoreOptionsContextMenuFlyout';
1513

1614
export default {
1715
title: 'ModularComponents/Flyout',
@@ -45,7 +43,6 @@ const initialState = {
4543
noIcons: true,
4644
[DataElements.MAIN_MENU]: true,
4745
menuWithComponentItems: true,
48-
bookmarkOutlineFlyout: true,
4946
},
5047
customPanels: [],
5148
genericPanels: [],
@@ -385,10 +382,6 @@ const initialState = {
385382
{ dataElement: 'annotationEditToolButton', toolName: 'AnnotationEdit', className: 'FlyoutToolButton' },
386383
],
387384
},
388-
'bookmarkOutlineFlyout': {
389-
dataElement: 'bookmarkOutlineFlyout',
390-
items: createItemsForBookmarkOutlineFlyout(MenuItemsForBookmarkOutlines, 'portfolio', false, () => {}, menuTypes),
391-
},
392385
},
393386
modularComponents: {
394387
panToolButton: {
@@ -535,20 +528,3 @@ FlyoutComponent.play = async ({ canvasElement }) => {
535528
const option1SecondRef = await canvas.findByRole('button', { name: /Item 1/i });
536529
expect(option1SecondRef).toBeInTheDocument();
537530
};
538-
539-
const portfolioFlyoutStore = configureStore({
540-
reducer: () => {
541-
return {
542-
...initialState,
543-
viewer: { ...initialState.viewer, activeFlyout: 'bookmarkOutlineFlyout' }
544-
};
545-
}
546-
});
547-
548-
export const PortfolioFlyout = () => {
549-
return (
550-
<Provider store={portfolioFlyoutStore}>
551-
<Flyout />
552-
</Provider>
553-
);
554-
};

src/components/MoreOptionsContextMenuFlyout/MoreOptionsContextMenuFlyout.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useLayoutEffect } from 'react';
22
import { useDispatch } from 'react-redux';
33
import actions from 'actions';
44
import PropTypes from 'prop-types';
5-
import createItemsForBookmarkOutlineFlyout from 'src/helpers/createItemsForBookmarkOutlineFlyout';
65

76
const createFlyoutItem = (option, icon, label) => ({
87
icon,
@@ -51,7 +50,36 @@ const MoreOptionsContextMenuFlyout = ({
5150
const bookmarkOutlineFlyout = {
5251
dataElement: flyoutSelector,
5352
className: 'MoreOptionsContextMenuFlyout',
54-
items: createItemsForBookmarkOutlineFlyout(menuItems, type, shouldHideDeleteButton, handleOnClick, menuTypes),
53+
items: menuItems.map((item) => {
54+
const { option } = item;
55+
let hidden = false;
56+
if (option === menuTypes.DELETE) {
57+
hidden = shouldHideDeleteButton;
58+
}
59+
if ([menuTypes.DOWNLOAD, menuTypes.OPENFILE].includes(option)) {
60+
hidden = type !== 'portfolio';
61+
}
62+
if (option === menuTypes.SETDEST) {
63+
hidden = type !== 'outline';
64+
}
65+
if (option === menuTypes.OPENFORMFIELDPANEL) {
66+
hidden = ['portfolio', 'bookmark'].includes(type);
67+
}
68+
if ([menuTypes.MOVE_UP, menuTypes.MOVE_DOWN].includes(option)) {
69+
hidden = !['portfolio'].includes(type);
70+
}
71+
72+
if ([menuTypes.MOVE_LEFT, menuTypes.MOVE_RIGHT, menuTypes.MOVE_UP, menuTypes.MOVE_DOWN].includes(option)) {
73+
hidden = type !== 'outline';
74+
}
75+
76+
return {
77+
...item,
78+
hidden,
79+
dataElement: `${type}${item.dataElement}`,
80+
onClick: () => handleOnClick(item.option),
81+
};
82+
}),
5583
};
5684
async function runDispatch() {
5785
if (!currentFlyout) {

src/components/ScaleOverlay/MeasurementDetail.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ const propTypes = {
1616
annotation: PropTypes.object,
1717
isOpen: PropTypes.bool.isRequired,
1818
selectedTool: PropTypes.object,
19-
canModify: PropTypes.bool,
2019
};
2120

22-
const MeasurementDetail = ({ annotation, isOpen, selectedTool, canModify }) => {
21+
const MeasurementDetail = ({ annotation, isOpen, selectedTool }) => {
2322
const { t } = useTranslation();
2423

2524
const data = useMemo(() => {
@@ -143,7 +142,7 @@ const MeasurementDetail = ({ annotation, isOpen, selectedTool, canModify }) => {
143142
const renderDetails = () => {
144143
const { key, precision } = data;
145144
if (key === 'ellipseMeasurement') {
146-
return <EllipseMeasurementOverlay annotation={annotation} selectedTool={selectedTool} isOpen={isOpen} canModify={canModify} />;
145+
return <EllipseMeasurementOverlay annotation={annotation} selectedTool={selectedTool} isOpen={isOpen} />;
147146
}
148147

149148
return (
@@ -155,7 +154,7 @@ const MeasurementDetail = ({ annotation, isOpen, selectedTool, canModify }) => {
155154
</div>
156155
</div>
157156
{key === 'distanceMeasurement' && (
158-
<LineMeasurementInput annotation={annotation} isOpen={isOpen} selectedTool={selectedTool} canModify={canModify} />
157+
<LineMeasurementInput annotation={annotation} isOpen={isOpen} selectedTool={selectedTool} />
159158
)}
160159
{[
161160
'rectangularAreaMeasurement',

src/components/ScaleOverlay/ScaleOverlay.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ const ScaleOverlay = ({
9393
}, [annotations, selectedTool, scales]);
9494

9595
const totalScales = Object.keys(scales).map((scale) => new Scale(scale));
96-
const canModifyMeasurement = annotations.length === 1 ? core.canModify(annotations[0]) : false;
9796

9897
return isCalibration ? (
9998
<CalibrationOverlay
@@ -115,7 +114,6 @@ const ScaleOverlay = ({
115114
annotation={annotations.length > 1 ? null : annotations[0] || null}
116115
selectedTool={selectedTool}
117116
isOpen
118-
canModify={canModifyMeasurement}
119117
/>
120118
)}
121119
</>

src/components/ScaleOverlay/ScaleOverlay.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@
534534
& .scale-overlay-arrow {
535535
display: flex;
536536
justify-content: center;
537-
align-items: center;
538537
width: 24px;
539538
height: 24px;
540539
color: var(--text-color);

0 commit comments

Comments
 (0)