mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
[MIRROR] Adds config Input to the colorMatrix (#8922)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
@@ -108,6 +108,16 @@
|
|||||||
if("set_matrix_color")
|
if("set_matrix_color")
|
||||||
color_matrix_last[params["color"]] = params["value"]
|
color_matrix_last[params["color"]] = params["value"]
|
||||||
return TRUE
|
return TRUE
|
||||||
|
if("set_matrix_string")
|
||||||
|
if(params["value"])
|
||||||
|
var/list/colours = splittext(params["value"], ",")
|
||||||
|
if(colours.len > 12)
|
||||||
|
colours.Cut(13)
|
||||||
|
for(var/i = 1, i <= colours.len, i++)
|
||||||
|
var/number = text2num(colours[i])
|
||||||
|
if(isnum(number))
|
||||||
|
color_matrix_last[i] = clamp(number, -10, 10)
|
||||||
|
return TRUE
|
||||||
if("set_hue")
|
if("set_hue")
|
||||||
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
|
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -189,6 +189,16 @@
|
|||||||
if("set_matrix_color")
|
if("set_matrix_color")
|
||||||
color_matrix_last[params["color"]] = params["value"]
|
color_matrix_last[params["color"]] = params["value"]
|
||||||
return TRUE
|
return TRUE
|
||||||
|
if("set_matrix_string")
|
||||||
|
if(params["value"])
|
||||||
|
var/list/colours = splittext(params["value"], ",")
|
||||||
|
if(colours.len > 12)
|
||||||
|
colours.Cut(13)
|
||||||
|
for(var/i = 1, i <= colours.len, i++)
|
||||||
|
var/number = text2num(colours[i])
|
||||||
|
if(isnum(number))
|
||||||
|
color_matrix_last[i] = clamp(number, -10, 10)
|
||||||
|
return TRUE
|
||||||
if("set_hue")
|
if("set_hue")
|
||||||
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
|
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import { toFixed } from 'common/math';
|
import { toFixed } from 'common/math';
|
||||||
|
|
||||||
import { useBackend } from '../../backend';
|
import { useBackend } from '../../backend';
|
||||||
import { Icon, NumberInput, Table } from '../../components';
|
import {
|
||||||
|
Box,
|
||||||
|
Icon,
|
||||||
|
Input,
|
||||||
|
LabeledList,
|
||||||
|
NumberInput,
|
||||||
|
Table,
|
||||||
|
} from '../../components';
|
||||||
import { Data } from './types';
|
import { Data } from './types';
|
||||||
|
|
||||||
export const ColorMateMatrix = (props) => {
|
export const ColorMateMatrix = (props) => {
|
||||||
@@ -10,6 +17,7 @@ export const ColorMateMatrix = (props) => {
|
|||||||
const { matrixcolors } = data;
|
const { matrixcolors } = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Table>
|
<Table>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
@@ -227,9 +235,23 @@ export const ColorMateMatrix = (props) => {
|
|||||||
<Icon name="question-circle" color="blue" /> RG means red will become
|
<Icon name="question-circle" color="blue" /> RG means red will become
|
||||||
this much green.
|
this much green.
|
||||||
<br />
|
<br />
|
||||||
<Icon name="question-circle" color="blue" /> CR means this much red will
|
<Icon name="question-circle" color="blue" /> CR means this much red
|
||||||
be added.
|
will be added.
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
</Table>
|
</Table>
|
||||||
|
<Box mt={3}>
|
||||||
|
<LabeledList>
|
||||||
|
<LabeledList.Item label="Config">
|
||||||
|
<Input
|
||||||
|
fluid
|
||||||
|
value={Object.values(matrixcolors).toString()}
|
||||||
|
onChange={(e, value: string) =>
|
||||||
|
act('set_matrix_string', { value })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</LabeledList.Item>
|
||||||
|
</LabeledList>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user