diff --git a/src/client/types/number.type-renderer.jsx b/src/client/types/number.type-renderer.jsx
index c11594c..8a2d00a 100644
--- a/src/client/types/number.type-renderer.jsx
+++ b/src/client/types/number.type-renderer.jsx
@@ -10,6 +10,10 @@ const decorate = compose(
);
const Number = ({
+ dispatchers: {
+ onChange = () => {},
+ onIncrement = () => {},
+ },
options,
value,
}) => (
@@ -26,14 +30,24 @@ const Number = ({
: (
<>
onChange(event.target.value)}
// onWheel={(e) => (e.preventDefault(), false)}
- readOnly
type="text"
value={value}
/>
-
-
+
+
>
)
diff --git a/src/common/resources/entity/state.js b/src/common/resources/entity/state.js
index 6fea5d4..0b8c976 100644
--- a/src/common/resources/entity/state.js
+++ b/src/common/resources/entity/state.js
@@ -67,6 +67,22 @@ const slice = createSlice({
name: 'entities',
initialState: adapter.getInitialState({uris: {}}),
reducers: {
+ incrementTraitProperty: (state, {
+ payload: {
+ target,
+ trait,
+ type,
+ key,
+ value,
+ },
+ }) => {
+ const {traits} = state.entities[target];
+ traits[trait] = traits[trait] || {};
+ traits[trait][type] = traits[trait][type] || {};
+ traits[trait][type][key] = traits[trait][type][key] || 0;
+ traits[trait][type][key] += parseFloat(value);
+ state.entities[target].traits = traits;
+ },
setTraitProperty: (state, {
payload: {
target,
@@ -94,6 +110,7 @@ const slice = createSlice({
});
export const {
+ incrementTraitProperty,
setTraitProperty,
} = slice.actions;
diff --git a/src/common/resources/entity/trait-pane.jsx b/src/common/resources/entity/trait-pane.jsx
index 3afed1f..3814fef 100644
--- a/src/common/resources/entity/trait-pane.jsx
+++ b/src/common/resources/entity/trait-pane.jsx
@@ -7,7 +7,7 @@ import {useDispatch} from 'react-redux';
import Value from '~/client/value';
-import {setTraitProperty} from './state';
+import {incrementTraitProperty, setTraitProperty} from './state';
let TraitComponents;
const ensureTraitComponents = () => {
@@ -52,6 +52,13 @@ const makePane = (context, dispatch, target, type) => (trait) => {
key,
value,
})),
+ onIncrement: (value) => dispatch(incrementTraitProperty({
+ target,
+ trait: type,
+ type: traitHalf,
+ key,
+ value,
+ })),
}}
options={options}
value={values[key]}