|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
724 bytes
|
| Line | |
|---|
| 1 | import { createSlice } from '@reduxjs/toolkit';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * From all Brush properties, only height has a default value and will always be defined.
|
|---|
| 5 | * Other properties are nullable and will be computed from offsets and margins if they are not set.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | var initialState = {
|
|---|
| 9 | x: 0,
|
|---|
| 10 | y: 0,
|
|---|
| 11 | width: 0,
|
|---|
| 12 | height: 0,
|
|---|
| 13 | padding: {
|
|---|
| 14 | top: 0,
|
|---|
| 15 | right: 0,
|
|---|
| 16 | bottom: 0,
|
|---|
| 17 | left: 0
|
|---|
| 18 | }
|
|---|
| 19 | };
|
|---|
| 20 | export var brushSlice = createSlice({
|
|---|
| 21 | name: 'brush',
|
|---|
| 22 | initialState,
|
|---|
| 23 | reducers: {
|
|---|
| 24 | setBrushSettings(_state, action) {
|
|---|
| 25 | if (action.payload == null) {
|
|---|
| 26 | return initialState;
|
|---|
| 27 | }
|
|---|
| 28 | return action.payload;
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | });
|
|---|
| 32 | export var {
|
|---|
| 33 | setBrushSettings
|
|---|
| 34 | } = brushSlice.actions;
|
|---|
| 35 | export var brushReducer = brushSlice.reducer; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.