Nudging behavior on number props can now be customized

This commit is contained in:
Aria Minaei 2021-08-22 12:58:38 +02:00
parent 74724d7ec1
commit 36017c6a73
7 changed files with 81 additions and 14 deletions

View file

@ -13,7 +13,7 @@ const editorSheetObjectConfig = types.compound({
showAxes: types.boolean(true, {label: 'Axes'}),
showGrid: types.boolean(true, {label: 'Grid'}),
showOverlayIcons: types.boolean(false, {label: 'Overlay Icons'}),
resolution: types.number(1440, {
resolution: types.number(500, {
label: 'Resolution',
range: [0, 1000],
}),

View file

@ -18,21 +18,25 @@ export type TransformControlsMode = 'translate' | 'rotate' | 'scale'
export type TransformControlsSpace = 'world' | 'local'
export type ViewportShading = 'wireframe' | 'flat' | 'solid' | 'rendered'
const positionComp = types.number(1, {nudgeMultiplier: 0.1})
const rotationComp = types.number(1, {nudgeMultiplier: 0.02})
const scaleComp = types.number(1, {nudgeMultiplier: 0.1})
export const baseSheetObjectType = types.compound({
position: types.compound({
x: types.number(0),
y: types.number(0),
z: types.number(0),
x: positionComp,
y: positionComp,
z: positionComp,
}),
rotation: types.compound({
x: types.number(0),
y: types.number(0),
z: types.number(0),
x: rotationComp,
y: rotationComp,
z: rotationComp,
}),
scale: types.compound({
x: types.number(1),
y: types.number(1),
z: types.number(1),
x: scaleComp,
y: scaleComp,
z: scaleComp,
}),
})