@ombori/ga-gridapp-iframe
Advanced tools
Comparing version 2.197.1 to 2.197.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.197.2](https://github.com/ombori/gridapp/compare/v2.197.1...v2.197.2) (2022-04-16) | ||
### Bug Fixes | ||
* handle resizes with the scaling ([4048be3](https://github.com/ombori/gridapp/commit/4048be3f8923bff0152a4ad3240eb7e4947a5b89)) | ||
## [2.197.1](https://github.com/ombori/gridapp/compare/v2.197.0...v2.197.1) (2022-04-16) | ||
@@ -8,0 +19,0 @@ |
@@ -24,2 +24,3 @@ var __assign = (this && this.__assign) || function () { | ||
import React, { useEffect, useRef } from 'react'; | ||
import { debounce } from 'lodash'; | ||
var GridappIframe = function (props) { | ||
@@ -67,4 +68,17 @@ var root = props.root, id = props.id, settings = props.settings, src = props.src, restProps = __rest(props, ["root", "id", "settings", "src"]); | ||
}, []); | ||
var width = window.innerWidth; | ||
var height = window.innerHeight; | ||
var _a = React.useState({ | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
}), dim = _a[0], setDimensions = _a[1]; | ||
console.log({ dim: dim }); | ||
var handleResize = debounce(function () { | ||
setDimensions({ | ||
width: window.innerWidth, | ||
height: window.innerHeight, | ||
}); | ||
}, 500); | ||
useEffect(function () { | ||
window.addEventListener('resize', handleResize, false); | ||
}, []); | ||
var width = dim.width, height = dim.height; | ||
var isPortrait = width < height; | ||
@@ -74,3 +88,2 @@ var scalingFactor = isPortrait ? width / 1080 : height / 1080; | ||
var scaledWidth = isPortrait ? 1080 : width / scalingFactor; | ||
// console.log({width, height, isPortrait, scalingFactor, scaledHeight, scaledWidth}); | ||
var iframeStyles = { | ||
@@ -77,0 +90,0 @@ position: 'absolute', |
{ | ||
"name": "@ombori/ga-gridapp-iframe", | ||
"version": "2.197.1", | ||
"version": "2.197.2", | ||
"main": "dist/index.js", | ||
@@ -16,3 +16,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "09510536352d7c34efcc7ae796800f03934a83ce" | ||
"gitHead": "cceb8ea852e3d33cb2d2810ffff735408e529ecc" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16263
347