@yodaos-pkg/ink 0.9.0 → 0.9.1
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/index.js +17 -3
- package/package.json +1 -1
- package/pkg/ink_web.js +4 -4
- package/pkg/ink_web_bg.wasm +0 -0
package/index.js
CHANGED
|
@@ -14,6 +14,20 @@ function getDefaultScaleFactor() {
|
|
|
14
14
|
return Number(globalThis.devicePixelRatio || 1);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
function normalizeScaleFactor(value) {
|
|
18
|
+
const numericValue = Number(value);
|
|
19
|
+
if (Number.isFinite(numericValue) && numericValue > 0) {
|
|
20
|
+
return numericValue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const defaultScaleFactor = getDefaultScaleFactor();
|
|
24
|
+
if (Number.isFinite(defaultScaleFactor) && defaultScaleFactor > 0) {
|
|
25
|
+
return defaultScaleFactor;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
function ensureFetch(fetchImpl) {
|
|
18
32
|
const resolved = fetchImpl || globalThis.fetch;
|
|
19
33
|
if (typeof resolved !== 'function') {
|
|
@@ -462,7 +476,7 @@ export class InkView {
|
|
|
462
476
|
const width = Number(config.width);
|
|
463
477
|
const layoutMode = normalizeLayoutMode(config.layoutMode);
|
|
464
478
|
const height = Number(config.height);
|
|
465
|
-
const scaleFactor =
|
|
479
|
+
const scaleFactor = normalizeScaleFactor(config.scaleFactor);
|
|
466
480
|
|
|
467
481
|
if (!Number.isFinite(width)) {
|
|
468
482
|
throw new Error('`width` is a required numeric value.');
|
|
@@ -527,7 +541,7 @@ export class InkView {
|
|
|
527
541
|
this.#boundedHeight = Number(options.height) || 1;
|
|
528
542
|
this.#layoutMode = normalizeLayoutMode(options.layoutMode);
|
|
529
543
|
this.#latestContentSize = null;
|
|
530
|
-
this.#scaleFactor =
|
|
544
|
+
this.#scaleFactor = normalizeScaleFactor(options.scaleFactor);
|
|
531
545
|
this.#surfaceBinding = null;
|
|
532
546
|
this.#onContentSizeChanged = null;
|
|
533
547
|
this.onContentSizeChanged = options.onContentSizeChanged || null;
|
|
@@ -1035,7 +1049,7 @@ export class InkView {
|
|
|
1035
1049
|
if (this.#layoutMode === 'bounded') {
|
|
1036
1050
|
this.#boundedHeight = nextHeight;
|
|
1037
1051
|
}
|
|
1038
|
-
this.#scaleFactor =
|
|
1052
|
+
this.#scaleFactor = normalizeScaleFactor(scaleFactor);
|
|
1039
1053
|
this.#syncRawViewSize();
|
|
1040
1054
|
if (this.#surfaceBinding?.type === 'html-canvas') {
|
|
1041
1055
|
this.#syncHtmlCanvasBindingSize(this.#logicalWidth, this.#logicalHeight, {
|
package/package.json
CHANGED
package/pkg/ink_web.js
CHANGED
|
@@ -1147,22 +1147,22 @@ function __wbg_get_imports() {
|
|
|
1147
1147
|
return ret;
|
|
1148
1148
|
},
|
|
1149
1149
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1150
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
1150
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2526, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1151
1151
|
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1152
1152
|
return addHeapObject(ret);
|
|
1153
1153
|
},
|
|
1154
1154
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1155
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("Event")], shim_idx:
|
|
1155
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("Event")], shim_idx: 2526, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1156
1156
|
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1157
1157
|
return addHeapObject(ret);
|
|
1158
1158
|
},
|
|
1159
1159
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1160
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
1160
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2526, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1161
1161
|
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9754);
|
|
1162
1162
|
return addHeapObject(ret);
|
|
1163
1163
|
},
|
|
1164
1164
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1165
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [], shim_idx:
|
|
1165
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2522, function: Function { arguments: [], shim_idx: 2523, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1166
1166
|
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9470, __wasm_bindgen_func_elem_9755);
|
|
1167
1167
|
return addHeapObject(ret);
|
|
1168
1168
|
},
|
package/pkg/ink_web_bg.wasm
CHANGED
|
Binary file
|