Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

add commitProperty to colorInput onChange #10403

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const GroundPlaneNodeEditor: EditorComponentType = (props) => {
sketchPickerClassName="mt-2"
value={groundPlaneComponent.color.value}
onChange={updateProperty(GroundPlaneComponent, 'color')}
onRelease={commitProperty(GroundPlaneComponent, 'color')}
/>
</InputGroup>
<InputGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const SkyboxNodeEditor: EditorComponentType = (props) => {
<ColorInput
value={skyboxComponent.backgroundColor.value}
onChange={updateProperty(SkyboxComponent, 'backgroundColor')}
//onRelease={commitProperty(SkyboxComponent, 'backgroundColor')}
onRelease={commitProperty(SkyboxComponent, 'backgroundColor')}
/>
</InputGroup>
)
Expand Down
7 changes: 5 additions & 2 deletions packages/ui/src/primitives/tailwind/Color/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Original Code is the Ethereal Engine team.
All portions of the code written by the Ethereal Engine team are Copyright © 2021-2023
Ethereal Engine. All Rights Reserved.
*/

import { ColorResult } from '@uiw/color-convert'
import SketchPicker from '@uiw/react-color-sketch'
import React from 'react'
Expand All @@ -34,6 +33,7 @@ import Text from '../Text'
interface ColorInputProp {
value: Color
onChange: (color: Color) => void
onRelease?: (color: Color) => void
disabled?: boolean
isValueAsInteger?: boolean
className?: string
Expand All @@ -44,6 +44,7 @@ interface ColorInputProp {
export function ColorInput({
value,
onChange,
onRelease,
disabled,
className,
textClassName,
Expand All @@ -55,7 +56,6 @@ export function ColorInput({
const color = new Color(result.hex)
onChange(color)
}

return (
<div
className={twMerge(
Expand All @@ -77,6 +77,9 @@ export function ColorInput({
color={hexColor}
onChange={handleChange}
disableAlpha={true}
onPointerLeave={() => {
onRelease && onRelease(value)
}}
/>
</div>
<Text fontFamily="Figtree" fontSize="xs" className={textClassName}>
Expand Down
Loading