Skip to content

Commit

Permalink
[TGUI] Color Picker (#1602)
Browse files Browse the repository at this point in the history
* fix color input

* small optimisation

* better optimisation

* more optimisation
  • Loading branch information
Phoenix4O4 authored Dec 12, 2024
1 parent 90b3f37 commit 4a9289f
Show file tree
Hide file tree
Showing 2 changed files with 506 additions and 464 deletions.
10 changes: 5 additions & 5 deletions tgui/packages/tgui/components/Interactive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getRelativePosition = (
export interface InteractiveProps {
onMove: (interaction: Interaction) => void;
onKey: (offset: Interaction) => void;
children: ReactNode[];
children: ReactNode; // Change from ReactNode[] to ReactNode
style?: React.CSSProperties;
}

Expand All @@ -74,7 +74,6 @@ export class Interactive extends Component<InteractiveProps> {
};

handleMove = (event: MouseEvent) => {
// Prevent text selection
event.preventDefault();

const isDown = event.buttons > 0;
Expand Down Expand Up @@ -121,18 +120,19 @@ export class Interactive extends Component<InteractiveProps> {
}

render() {
const { style, children, ...rest } = this.props;
return (
<div
{...this.props}
style={this.props.style}
{...rest}
style={style}
ref={this.containerRef}
onMouseDown={this.handleMoveStart}
className="react-colorful__interactive"
onKeyDown={this.handleKeyDown}
tabIndex={0}
role="slider"
>
{this.props.children}
{children}
</div>
);
}
Expand Down
Loading

0 comments on commit 4a9289f

Please sign in to comment.