ocp-viewer-core 1.0.4 → 1.1.0
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/package.json +2 -2
- package/src/notify.js +3 -0
- package/src/page.js +13 -1
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ocp-viewer-core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared viewer policy for ocp_vscode, ocp_viewer, Jupyter CadQuery and build123d Studio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"src"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"three-cad-viewer": ">=5.0
|
|
14
|
+
"three-cad-viewer": ">=5.1.0 <5.2.0"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"author": "Bernhard Walter <b_walter@arcor.de>",
|
package/src/notify.js
CHANGED
|
@@ -45,6 +45,9 @@ export const EVENT_KEYS = new Set([
|
|
|
45
45
|
"lastPick",
|
|
46
46
|
"activeTool",
|
|
47
47
|
"relative_time",
|
|
48
|
+
// three-cad-viewer 5.1: the point Ctrl/Cmd-C copied, for hosts whose page
|
|
49
|
+
// cannot reach the clipboard. A copy, not a property of the viewer.
|
|
50
|
+
"copiedPoint",
|
|
48
51
|
]);
|
|
49
52
|
|
|
50
53
|
/**
|
package/src/page.js
CHANGED
|
@@ -237,9 +237,21 @@ export function createPage({
|
|
|
237
237
|
if (getSize != null) {
|
|
238
238
|
return getSize();
|
|
239
239
|
}
|
|
240
|
+
// The window, less the container's own offset in it - a page's body
|
|
241
|
+
// margin - above it and, for the same margin, below it. The chrome is
|
|
242
|
+
// measured from the container's top, so an offset of the container
|
|
243
|
+
// itself was counted nowhere: the standalone page keeps the browser's
|
|
244
|
+
// 8px body margin, and its canvas ended 8px under the window edge,
|
|
245
|
+
// cutting the status line pinned to `bottom: 4px` inside it. A VS Code
|
|
246
|
+
// webview's body has no margin, so its offset is 0.
|
|
247
|
+
const element = getContainer();
|
|
248
|
+
const top =
|
|
249
|
+
element == null
|
|
250
|
+
? 0
|
|
251
|
+
: Math.max(0, Math.round(element.getBoundingClientRect().top));
|
|
240
252
|
return {
|
|
241
253
|
width: window.innerWidth,
|
|
242
|
-
height: window.innerHeight
|
|
254
|
+
height: window.innerHeight - 2 * top
|
|
243
255
|
};
|
|
244
256
|
}
|
|
245
257
|
|
package/src/version.js
CHANGED