diff --git a/src/api/utils/ColorUtils.ts b/src/api/utils/ColorUtils.ts
index 100bcc5b..a22c90a4 100644
--- a/src/api/utils/ColorUtils.ts
+++ b/src/api/utils/ColorUtils.ts
@@ -24,10 +24,39 @@ export class ColorUtils
return parseInt(color.replace('#', ''), 16);
}
- public static uintHexColor(color: number): string
+ public static uintHexColor(color: number): string
{
const realColor = color >>>0;
return ColorUtils.makeColorHex(realColor.toString(16).substring(2));
}
+
+ /**
+ * Converts an integer format into an array of 8-bit values
+ * @param {number} value value in integer format
+ * @returns {Array} 8-bit values
+ */
+ public static int_to_8BitVals(value: number): [number, number, number, number]
+ {
+ const val1 = ((value >> 24) & 0xFF)
+ const val2 = ((value >> 16) & 0xFF);
+ const val3 = ((value >> 8) & 0xFF);
+ const val4 = (value & 0xFF);
+
+ return [ val1, val2, val3, val4 ];
+ }
+
+ /**
+ * Combines 4 8-bit values into a 32-bit integer. Values are combined in
+ * in the order of the parameters
+ * @param val1
+ * @param val2
+ * @param val3
+ * @param val4
+ * @returns 32-bit integer of combined values
+ */
+ public static eight_bitVals_to_int(val1: number, val2: number, val3: number, val4: number): number
+ {
+ return (((val1) << 24) + ((val2) << 16) + ((val3) << 8) + (val4| 0));
+ }
}
diff --git a/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx b/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx
index 804462d6..df159d50 100644
--- a/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx
+++ b/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx
@@ -1,12 +1,11 @@
import { FC } from 'react';
-import ReactSlider from 'react-slider';
-import { LocalizeText } from '../../../../api';
-import { Button, Column, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
+import { ColorUtils, LocalizeText } from '../../../../api';
+import { Button, Column, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { useFurnitureBackgroundColorWidget } from '../../../../hooks';
export const FurnitureBackgroundColorView: FC<{}> = props =>
{
- const { objectId = -1, hue = 0, setHue = null, saturation = 0, setSaturation = null, lightness = 0, setLightness = null, applyToner = null, toggleToner = null, onClose = null } = useFurnitureBackgroundColorWidget();
+ const { objectId = -1, color = 0, setColor = null, applyToner = null, toggleToner = null, onClose = null } = useFurnitureBackgroundColorWidget();
if(objectId === -1) return null;
@@ -15,39 +14,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
-
- { LocalizeText('widget.backgroundcolor.hue') }
- setHue(event) }
- thumbClassName={ 'thumb degree' }
- renderThumb={ (props, state) => { state.valueNow }
} />
-
-
- { LocalizeText('widget.backgroundcolor.saturation') }
- setSaturation(event) }
- thumbClassName={ 'thumb degree' }
- renderThumb={ (props, state) => { state.valueNow }
} />
-
-
- { LocalizeText('widget.backgroundcolor.lightness') }
- setLightness(event) }
- thumbClassName={ 'thumb degree' }
- renderThumb={ (props, state) => { state.valueNow }
} />
-
+ setColor(ColorUtils.convertFromHex(event.target.value)) } />