Skip to content

Commit

Permalink
update: fix hue filter
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMonad authored and harry75369 committed Jul 3, 2024
1 parent 77b63b9 commit fb8506b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
15 changes: 8 additions & 7 deletions docs/features/graphic/image_filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { JSONPath } from "jsonpath-plus"
value: 0.23,
valuePath:
"$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.exposure",
min: 0,
min: -1,
max: 1,
step: 0.01,
},
Expand All @@ -26,7 +26,7 @@ import { JSONPath } from "jsonpath-plus"
value: 0,
valuePath:
"$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.contrast",
min: 0,
min: -1,
max: 1,
step: 0.01,
},
Expand All @@ -37,7 +37,7 @@ import { JSONPath } from "jsonpath-plus"
value: 0,
valuePath:
"$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.saturation",
min: 0,
min: -1,
max: 1,
step: 0.01,
},
Expand All @@ -48,7 +48,7 @@ import { JSONPath } from "jsonpath-plus"
value: 0,
valuePath:
"$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.temperature",
min: 0,
min: -1,
max: 1,
step: 0.01,
},
Expand All @@ -58,7 +58,7 @@ import { JSONPath } from "jsonpath-plus"
controlType: 'slider',
value: 0,
valuePath: '$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.tint',
min:0,
min: -1,
max:1,
step: 0.01
},
Expand All @@ -68,7 +68,7 @@ import { JSONPath } from "jsonpath-plus"
controlType: 'slider',
value: 0,
valuePath: '$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.highlights',
min:0,
min: -1,
max:1,
step: 0.01
},
Expand All @@ -78,7 +78,7 @@ import { JSONPath } from "jsonpath-plus"
controlType: 'slider',
value: 0,
valuePath: '$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters.shadows',
min:0,
min: -1,
max:1,
step: 0.01
},
Expand All @@ -100,6 +100,7 @@ import { JSONPath } from "jsonpath-plus"
path: "$.frames[0].childObjects[0].style.fills[0].pattern.instance.imageFilters",
resultType: "all",
}).forEach(({ parent, parentProperty }) => {
console.log(parent, parentProperty)
parent["imageFilters"] = {
...parent["imageFilters"],
hue: value,
Expand Down
3 changes: 2 additions & 1 deletion src/components/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ export function Controls({
(value: number, lineNumber?: number) => {
const { transformedValue, updatedCode } =
control.onBeforeChange?.(value, codeCache.current) ?? {}
onChange?.({
const newCode = onChange?.({
valuePath: control.valuePath,
value: transformedValue ?? value,
lineNumber: lineNumber ?? control.lineNumber,
lineNumberMatchType: control.lineNumberMatchType,
code: updatedCode,
})
codeCache.current = newCode ?? codeCache.current
},
100
)
Expand Down
6 changes: 5 additions & 1 deletion src/components/daruma-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ export function DarumaPlayer({
parent[parentProperty] = value
})

const newCode = JSON.stringify(codeJSON, null, 2)

setCodeBase((origin) => ({
...origin,
[fileName]: JSON.stringify(codeJSON, null, 2),
[fileName]: newCode,
}))

if (lineNumberMatchType) {
Expand All @@ -301,6 +303,8 @@ export function DarumaPlayer({
setLineNumberMatchType("range")
})
}, 100)

return newCode
}}
/>
</div>
Expand Down

0 comments on commit fb8506b

Please sign in to comment.