@fulate/import 1.0.5 → 1.0.7
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/dist/index.d.ts +0 -1
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ export type { ImportResult, Importer } from "./types";
|
|
|
2
2
|
export { importSketch, importSketchFile, SketchImporter } from "./sketch";
|
|
3
3
|
export { serializeScene, serializeSceneToJSON, deserializeElement, restoreScene, parseFileData, exportToFile, importFromFile } from "./fulate";
|
|
4
4
|
export type { FileData, DeserializeFactories, DeserializeFactory } from "./fulate";
|
|
5
|
-
export { restoreScene as restoreSceneBase } from "./util";
|
|
6
5
|
export type { ElementFilter, DeserializeFn, RestoreOptions } from "./util";
|
package/dist/index.js
CHANGED
|
@@ -612,13 +612,13 @@ function assignLinePath(base, layer) {
|
|
|
612
612
|
}
|
|
613
613
|
function parseSketchPoint(str, frameW, frameH) {
|
|
614
614
|
const match = str.match(/\{([^,]+),\s*([^}]+)\}/);
|
|
615
|
-
if (!match)
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
};
|
|
615
|
+
if (!match) throw new Error(`Invalid Sketch point: ${str}`);
|
|
616
|
+
const x = parseFloat(match[1]);
|
|
617
|
+
const y = parseFloat(match[2]);
|
|
618
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) throw new Error(`Invalid Sketch point: ${str}`);
|
|
619
619
|
return {
|
|
620
|
-
x:
|
|
621
|
-
y:
|
|
620
|
+
x: x * frameW,
|
|
621
|
+
y: y * frameH
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
624
|
function assignImageSrc(base, layer, ctx) {
|
|
@@ -742,4 +742,4 @@ async function importFromFile(root, filter, factories) {
|
|
|
742
742
|
return true;
|
|
743
743
|
}
|
|
744
744
|
//#endregion
|
|
745
|
-
export { SketchImporter, deserializeElement, exportToFile, importFromFile, importSketch, importSketchFile, parseFileData, restoreScene,
|
|
745
|
+
export { SketchImporter, deserializeElement, exportToFile, importFromFile, importSketch, importSketchFile, parseFileData, restoreScene, serializeScene, serializeSceneToJSON };
|