mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2025-04-19 01:16:25 +02:00
20 lines
642 B
JavaScript
20 lines
642 B
JavaScript
import { updateColor } from '../../selectionReducer.js';
|
|
import { getColor } from '../../../utils/objectSelectors.js';
|
|
import { updateTool as updateTool2d } from '../toolReducer.js';
|
|
|
|
export default function pipetteReducer(state, action) {
|
|
const [object] = action.objects;
|
|
if (object) {
|
|
const shapeData = state.objectsById[object];
|
|
let color;
|
|
if (shapeData.type === 'IMAGE_GUIDE') {
|
|
color = getColor(shapeData, action.position, action.screenMatrixZoom);
|
|
} else {
|
|
color = shapeData.color;
|
|
}
|
|
state = updateColor(state, color);
|
|
}
|
|
state = updateTool2d(state, state.context.lastTool);
|
|
return state;
|
|
}
|