fragment-tools 0.1.16 → 0.1.17
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 +1 -1
- package/src/cli/createConfig.js +1 -0
- package/src/cli/plugins/save.js +12 -6
- package/src/client/app/modules/Exports.svelte +0 -1
- package/src/client/app/renderers/P5GLRenderer.js +3 -1
- package/src/client/app/renderers/P5Renderer.js +10 -1
- package/src/client/app/utils/canvas.utils.js +2 -1
- package/src/client/app/utils/fields.utils.js +2 -2
package/package.json
CHANGED
package/src/cli/createConfig.js
CHANGED
package/src/cli/plugins/save.js
CHANGED
|
@@ -15,13 +15,13 @@ export default function screenshot({
|
|
|
15
15
|
cwd = process.cwd(),
|
|
16
16
|
inlineExportDir,
|
|
17
17
|
} = {}) {
|
|
18
|
-
function resolveDirectory(directoryPath) {
|
|
18
|
+
function resolveDirectory(directoryPath, dirname) {
|
|
19
19
|
return path.isAbsolute(directoryPath)
|
|
20
20
|
? directoryPath
|
|
21
|
-
: path.join(cwd, directoryPath);
|
|
21
|
+
: path.join(path.join(cwd, dirname), directoryPath);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function resolveExportDirectory(exportDir) {
|
|
24
|
+
function resolveExportDirectory(exportDir, dirname) {
|
|
25
25
|
let directory;
|
|
26
26
|
|
|
27
27
|
if (inlineExportDir) {
|
|
@@ -37,7 +37,7 @@ export default function screenshot({
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
} else if (exportDir) {
|
|
40
|
-
directory = resolveDirectory(exportDir);
|
|
40
|
+
directory = resolveDirectory(exportDir, dirname);
|
|
41
41
|
} else {
|
|
42
42
|
directory = cwd;
|
|
43
43
|
}
|
|
@@ -62,10 +62,16 @@ export default function screenshot({
|
|
|
62
62
|
const { filename, data, encoding, exportDir } =
|
|
63
63
|
files[i];
|
|
64
64
|
|
|
65
|
-
let directory = resolveExportDirectory(
|
|
65
|
+
let directory = resolveExportDirectory(
|
|
66
|
+
exportDir,
|
|
67
|
+
path.dirname(filename),
|
|
68
|
+
);
|
|
66
69
|
mkdirp(directory);
|
|
67
70
|
|
|
68
|
-
let filepath = path.join(
|
|
71
|
+
let filepath = path.join(
|
|
72
|
+
directory,
|
|
73
|
+
path.basename(filename),
|
|
74
|
+
);
|
|
69
75
|
|
|
70
76
|
let buffer = Buffer.from(
|
|
71
77
|
encoding === 'base64'
|
|
@@ -30,6 +30,7 @@ export let onBeforeUpdatePreview = ({ id }) => {
|
|
|
30
30
|
|
|
31
31
|
if (preview) {
|
|
32
32
|
preview.rendered = false;
|
|
33
|
+
preview.p.resetMatrix();
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
|
|
@@ -52,7 +53,8 @@ export let onResizePreview = ({ id, width, height, pixelRatio }) => {
|
|
|
52
53
|
const preview = previews.find((p) => p.id === id);
|
|
53
54
|
|
|
54
55
|
if (preview) {
|
|
55
|
-
preview.p.
|
|
56
|
+
preview.p.pixelDensity(pixelRatio);
|
|
57
|
+
preview.p.resizeCanvas(width, height, false);
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
60
|
|
|
@@ -22,11 +22,20 @@ export let onMountPreview = ({ id, width, height }) => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
export let onBeforeUpdatePreview = ({ id }) => {
|
|
26
|
+
const preview = previews.find((p) => p.id === id);
|
|
27
|
+
|
|
28
|
+
if (preview) {
|
|
29
|
+
preview.p.resetMatrix();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
25
33
|
export let onResizePreview = ({ id, width, height, pixelRatio }) => {
|
|
26
34
|
const preview = previews.find((p) => p.id === id);
|
|
27
35
|
|
|
28
36
|
if (preview) {
|
|
29
|
-
preview.p.
|
|
37
|
+
preview.p.pixelDensity(pixelRatio);
|
|
38
|
+
preview.p.resizeCanvas(width, height, false);
|
|
30
39
|
}
|
|
31
40
|
};
|
|
32
41
|
|
|
@@ -80,8 +80,8 @@ export function inferFieldType({ type, value, params, key }) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export function hasChanged(initialValue, currentValue) {
|
|
83
|
-
const initialType = typeof initialValue;
|
|
84
|
-
const currentType = typeof currentValue;
|
|
83
|
+
const initialType = initialValue && typeof initialValue;
|
|
84
|
+
const currentType = currentValue && typeof currentValue;
|
|
85
85
|
|
|
86
86
|
if (initialType !== currentType) return true;
|
|
87
87
|
|