@micromag/core 0.2.384 → 0.2.386
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.
- package/es/hooks.js +14 -5
- package/lib/hooks.js +14 -5
- package/package.json +2 -2
package/es/hooks.js
CHANGED
|
@@ -1125,21 +1125,30 @@ var useScreenSizeFromElement = function useScreenSizeFromElement() {
|
|
|
1125
1125
|
var fullWidth = width !== null ? width : calculatedWidth;
|
|
1126
1126
|
var fullHeight = height !== null ? height : calculatedHeight;
|
|
1127
1127
|
var landscape = fullHeight > 0 && fullWidth > fullHeight;
|
|
1128
|
-
|
|
1129
|
-
|
|
1128
|
+
|
|
1129
|
+
var _ref6 = opts || {},
|
|
1130
|
+
_ref6$withoutMaxSize = _ref6.withoutMaxSize,
|
|
1131
|
+
withoutMaxSize = _ref6$withoutMaxSize === void 0 ? false : _ref6$withoutMaxSize,
|
|
1132
|
+
_ref6$desktopHeightTh = _ref6.desktopHeightThreshold,
|
|
1133
|
+
desktopHeightThreshold = _ref6$desktopHeightTh === void 0 ? 600 : _ref6$desktopHeightTh,
|
|
1134
|
+
_ref6$desktopHeightRa = _ref6.desktopHeightRatio,
|
|
1135
|
+
desktopHeightRatio = _ref6$desktopHeightRa === void 0 ? 3 / 4 : _ref6$desktopHeightRa,
|
|
1136
|
+
_ref6$screenRatio = _ref6.screenRatio,
|
|
1137
|
+
screenRatio = _ref6$screenRatio === void 0 ? 2 / 3 : _ref6$screenRatio;
|
|
1138
|
+
|
|
1130
1139
|
var landscapeWithMaxSize = landscape && !withoutMaxSize;
|
|
1131
1140
|
var finalWidth = fullWidth;
|
|
1132
1141
|
var finalHeight = fullHeight;
|
|
1133
1142
|
var menuOverScreen = !landscape;
|
|
1134
1143
|
|
|
1135
1144
|
if (landscapeWithMaxSize) {
|
|
1136
|
-
if (fullHeight <
|
|
1145
|
+
if (fullHeight < desktopHeightThreshold) {
|
|
1137
1146
|
menuOverScreen = true;
|
|
1138
1147
|
} else {
|
|
1139
|
-
finalHeight = Math.round(fullHeight *
|
|
1148
|
+
finalHeight = Math.round(fullHeight * desktopHeightRatio);
|
|
1140
1149
|
}
|
|
1141
1150
|
|
|
1142
|
-
finalWidth = Math.round(finalHeight *
|
|
1151
|
+
finalWidth = Math.round(finalHeight * screenRatio);
|
|
1143
1152
|
}
|
|
1144
1153
|
|
|
1145
1154
|
if (finalWidth % 2 === 1) {
|
package/lib/hooks.js
CHANGED
|
@@ -1161,21 +1161,30 @@ var useScreenSizeFromElement = function useScreenSizeFromElement() {
|
|
|
1161
1161
|
var fullWidth = width !== null ? width : calculatedWidth;
|
|
1162
1162
|
var fullHeight = height !== null ? height : calculatedHeight;
|
|
1163
1163
|
var landscape = fullHeight > 0 && fullWidth > fullHeight;
|
|
1164
|
-
|
|
1165
|
-
|
|
1164
|
+
|
|
1165
|
+
var _ref6 = opts || {},
|
|
1166
|
+
_ref6$withoutMaxSize = _ref6.withoutMaxSize,
|
|
1167
|
+
withoutMaxSize = _ref6$withoutMaxSize === void 0 ? false : _ref6$withoutMaxSize,
|
|
1168
|
+
_ref6$desktopHeightTh = _ref6.desktopHeightThreshold,
|
|
1169
|
+
desktopHeightThreshold = _ref6$desktopHeightTh === void 0 ? 600 : _ref6$desktopHeightTh,
|
|
1170
|
+
_ref6$desktopHeightRa = _ref6.desktopHeightRatio,
|
|
1171
|
+
desktopHeightRatio = _ref6$desktopHeightRa === void 0 ? 3 / 4 : _ref6$desktopHeightRa,
|
|
1172
|
+
_ref6$screenRatio = _ref6.screenRatio,
|
|
1173
|
+
screenRatio = _ref6$screenRatio === void 0 ? 2 / 3 : _ref6$screenRatio;
|
|
1174
|
+
|
|
1166
1175
|
var landscapeWithMaxSize = landscape && !withoutMaxSize;
|
|
1167
1176
|
var finalWidth = fullWidth;
|
|
1168
1177
|
var finalHeight = fullHeight;
|
|
1169
1178
|
var menuOverScreen = !landscape;
|
|
1170
1179
|
|
|
1171
1180
|
if (landscapeWithMaxSize) {
|
|
1172
|
-
if (fullHeight <
|
|
1181
|
+
if (fullHeight < desktopHeightThreshold) {
|
|
1173
1182
|
menuOverScreen = true;
|
|
1174
1183
|
} else {
|
|
1175
|
-
finalHeight = Math.round(fullHeight *
|
|
1184
|
+
finalHeight = Math.round(fullHeight * desktopHeightRatio);
|
|
1176
1185
|
}
|
|
1177
1186
|
|
|
1178
|
-
finalWidth = Math.round(finalHeight *
|
|
1187
|
+
finalWidth = Math.round(finalHeight * screenRatio);
|
|
1179
1188
|
}
|
|
1180
1189
|
|
|
1181
1190
|
if (finalWidth % 2 === 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.386",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"publishConfig": {
|
|
126
126
|
"access": "public"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "ea1fb37b6e8b421e8df78c50d392187420cadc70"
|
|
129
129
|
}
|