mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +01:00
add open sketch func
This commit is contained in:
parent
e6cda7fbdb
commit
62847f4064
@ -85,6 +85,7 @@ export const FLOOD_FILL = 'FLOOD_FILL';
|
||||
export const TRACE_FLOOD_FILL = 'TRACE_FLOOD_FILL';
|
||||
export const MENU_OPEN = 'MENU_OPEN';
|
||||
export const MENU_CLOSE = 'MENU_CLOSE';
|
||||
export const OPEN_SKETCH = 'OPEN_SKETCH';
|
||||
|
||||
// CATEGORIES
|
||||
// actions that influence selected objects
|
||||
@ -494,3 +495,7 @@ export function menuOpen(menuValue) {
|
||||
export function menuClose(menuValue) {
|
||||
return { type: MENU_CLOSE, menuValue };
|
||||
}
|
||||
|
||||
export function openSketch(data) {
|
||||
return { type: OPEN_SKETCH };
|
||||
}
|
||||
|
@ -207,11 +207,31 @@ function sketcherReducer(state = initialState, action) {
|
||||
state = updateMenus(state, action);
|
||||
return state;
|
||||
|
||||
// actions.user.USER_LOGOUT_FULFILLED
|
||||
// actions.files.FILES_LOAD_FULFILLED:
|
||||
case actions.CLEAR:
|
||||
return initialState;
|
||||
|
||||
case actions.OPEN_SKETCH:
|
||||
let first = true;
|
||||
for (const space of action.data.data.spaces) {
|
||||
if (first) {
|
||||
state = addSpaceActive(state, space.matrix, 'world');
|
||||
} else {
|
||||
state = addSpaceActive(state, space.matrix);
|
||||
}
|
||||
|
||||
for (const object of space.objects) {
|
||||
if (first) {
|
||||
state = addObject(state, { ...object, space: 'world' });
|
||||
} else {
|
||||
state = addObject(state, object);
|
||||
}
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
return setActiveSpace(state, 'world');
|
||||
|
||||
case actions.DUPLICATE_SELECTION:
|
||||
case actions.DELETE_SELECTION:
|
||||
case actions.UNION:
|
||||
|
Loading…
Reference in New Issue
Block a user