@luomus/laji-form 15.1.40 → 15.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -310,6 +310,7 @@ MapField.propTypes = {
310
310
  };
311
311
  class MobileEditorMap extends React.Component {
312
312
  constructor(props) {
313
+ var _a, _b;
313
314
  super(props);
314
315
  this.DEFAULT_RADIUS_PIXELS = 100;
315
316
  this.setMobileEditorMapRef = (mapComponent) => {
@@ -322,7 +323,8 @@ class MobileEditorMap extends React.Component {
322
323
  this.okButtonElem = react_dom_1.findDOMNode(elem);
323
324
  };
324
325
  this.updateDimensions = () => {
325
- this.setState({ width: window.innerWidth, height: window.innerHeight });
326
+ var _a, _b;
327
+ this.setState({ width: ((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.width) || window.innerWidth, height: ((_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.height) || window.innerHeight });
326
328
  };
327
329
  this.onChange = () => {
328
330
  const { map } = this.map;
@@ -338,9 +340,10 @@ class MobileEditorMap extends React.Component {
338
340
  this.onClose();
339
341
  };
340
342
  this.computePadding = () => {
343
+ var _a, _b;
341
344
  // If the rendered element wasn't full screen, we couldn't use these as height/width.
342
- const height = window.innerHeight;
343
- const width = window.innerWidth;
345
+ const height = ((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) || window.innerHeight;
346
+ const width = ((_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.width) || window.innerWidth;
344
347
  const topToCircleEdgePixels = parseInt(height / 2 - this.DEFAULT_RADIUS_PIXELS);
345
348
  const leftToCircleEdgePixels = parseInt(width / 2 - this.DEFAULT_RADIUS_PIXELS);
346
349
  const padding = [
@@ -400,8 +403,8 @@ class MobileEditorMap extends React.Component {
400
403
  const { center, radius } = this.props;
401
404
  this.state = {
402
405
  mapOptions: this.setViewFromCenterAndRadius(center, radius),
403
- width: window.innerWidth,
404
- height: window.innerHeight
406
+ width: ((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.width) || window.innerWidth,
407
+ height: ((_b = window.visualViewport) === null || _b === void 0 ? void 0 : _b.height) || window.innerHeight,
405
408
  };
406
409
  }
407
410
  componentDidMount() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.40",
3
+ "version": "15.1.41",
4
4
  "description": "React module capable of building dynamic forms from Laji form json schemas",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",