Skip to content

Commit

Permalink
Merge pull request #397 from performant-software/blms/zoom-bug
Browse files Browse the repository at this point in the history
Fix zoom bug and registration messages
  • Loading branch information
blms authored Aug 25, 2021
2 parents 43bfeb1 + 0614681 commit 9b2b846
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
5 changes: 5 additions & 0 deletions app/views/admin_mailer/new_user_waiting_for_approval.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
<p><%= @email %> has registered to join your Digital Mappa instance at <%= @protocol + '://' + ENV['HOSTNAME'] %>.</p>
<p>You have received this email because you are designated as an administrator for this instance.</p>
<p>An instance admin can approve this registration by visiting the website and reviewing the user list.</p>
<p>
<strong>Reminder</strong>: once a new user is approved on this DM instance, to work on a specific project, they will
still need to be added to that project as a collaborator. <a href="https://www.digitalmappa.org/collaborators">Click here
for instructions for adding collaborators.</a>
</p>
16 changes: 8 additions & 8 deletions client/src/CanvasResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ const markerRadius = 4.0;
const doubleClickTimeout = 500;
const markerThumbnailSize = 100;
const fabricViewportScale = 2000;
const minZoomImageRatio = 0.9;
const maxZoomPixelRatio = 5.0;
const maxZoomLevel = 7.5;
const maxZoomPixelRatio = 2.25;

class CanvasResource extends Component {
constructor(props) {
Expand All @@ -93,6 +91,7 @@ class CanvasResource extends Component {
totalPages: 0,
layerName: '',
zoomLevel: 0,
maxZoom: 0,
minZoom: 0,
};
}
Expand Down Expand Up @@ -151,9 +150,7 @@ class CanvasResource extends Component {
prefixUrl: '/images/',
showNavigationControl: false,
tileSources: [],
minZoomImageRatio: minZoomImageRatio,
maxZoomPixelRatio: maxZoomPixelRatio,
maxZoomLevel,
maxZoomPixelRatio,
navigatorSizeRatio: 0.15,
gestureSettingsMouse: { clickToZoom: false },
showNavigator: true,
Expand Down Expand Up @@ -244,6 +241,9 @@ class CanvasResource extends Component {
}

viewer.addHandler('update-viewport', () => {
const maxZoom = this.osdViewer.viewport.getMaxZoom();
const minZoom = this.osdViewer.viewport.getMinZoom();
this.setState((prevState) => ({ ...prevState, minZoom, maxZoom }));
if (!this.viewportUpdatedForPageYet) {
this.renderHighlights(overlay, highlight_map);
this.viewportUpdatedForPageYet = true;
Expand Down Expand Up @@ -286,7 +286,7 @@ class CanvasResource extends Component {
} else if (event.zoom <= minZoom) {
zoomLevel = minZoom;
}
this.setState((prevState) => ({ ...prevState, zoomLevel, minZoom }));
this.setState((prevState) => ({ ...prevState, zoomLevel, minZoom, maxZoom }));
});

overlay.fabricCanvas().freeDrawingBrush.color = initialColor;
Expand Down Expand Up @@ -1382,7 +1382,7 @@ class CanvasResource extends Component {
axis='y'
step={0.01}
min={this.state.minZoom}
max={maxZoomLevel}
max={this.state.maxZoom}
value={this.state.zoomLevel}
onChange={this.zoomControlChange.bind(this)}
/>
Expand Down
16 changes: 15 additions & 1 deletion client/src/LoginRegistrationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,21 @@ class LoginRegistrationDialog extends Component {
{this.props.confirmUserSuccessDialogShown && (
<p style={{ color: blue900 }}>
{this.props.confirmUserErrored && 'There was an error confirming your email address.'}
{!this.props.confirmUserErrored && 'Your email has been successfully confirmed. You may now log in.'}
{!this.props.confirmUserErrored && (
<>
<p>
Congratulations, your <i>Digital Mappa</i> account and
email are confirmed! You may now log in.
</p>
<p>
Once an administrator approves your account, you may start using this
<i>Digital Mappa</i> instance in accordance with the permissions set by this
instance's administrator. To access any non-public projects on this DM instance,
you will still need to be added to a specific project by its project
administrator.
</p>
</>
)}
</p>
)}
{showEmailField &&
Expand Down

0 comments on commit 9b2b846

Please sign in to comment.