mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 19:13:49 +01:00
fix 2d holes rendering
This commit is contained in:
parent
6a54f540eb
commit
85d67dd103
@ -57,6 +57,10 @@ export default class Shape extends Matrix {
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this._shapeData || this._shapeData.solid !== shapeData.solid) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
this._shapeData = shapeData;
|
this._shapeData = shapeData;
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { shapeDataToShape, determineActiveShape } from '../shape/shapeDataUtils.js';
|
import { shapeDataToShape, determineActiveShape2d } from '../shape/shapeDataUtils.js';
|
||||||
// import R from 'ramda';
|
// import R from 'ramda';
|
||||||
|
|
||||||
export default class ShapesManager {
|
export default class ShapesManager {
|
||||||
@ -15,7 +15,7 @@ export default class ShapesManager {
|
|||||||
const needRender = { active: false, inactive: false };
|
const needRender = { active: false, inactive: false };
|
||||||
|
|
||||||
// determine if shape is "active", meaning it will be updated frequently
|
// determine if shape is "active", meaning it will be updated frequently
|
||||||
const activeShapes = determineActiveShape(state);
|
const activeShapes = determineActiveShape2d(state);
|
||||||
|
|
||||||
const { objectsById } = state;
|
const { objectsById } = state;
|
||||||
|
|
||||||
|
@ -70,27 +70,11 @@ function shapeDataToShapeRaw(shapeData) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO can maybe be memoized
|
export const determineActiveShape2d = (state) => {
|
||||||
export const determineActiveShape = (state) => {
|
|
||||||
const activeTransformer = state.d2.eraser.active ||
|
|
||||||
state.d2.transform.active ||
|
|
||||||
state.d3.height.active ||
|
|
||||||
state.d3.sculpt.activeHandle !== null ||
|
|
||||||
state.d3.twist.active;
|
|
||||||
|
|
||||||
const selectedObjects = state.selection.objects.map(({ id }) => id);
|
const selectedObjects = state.selection.objects.map(({ id }) => id);
|
||||||
const activeShapes = {};
|
const activeShapes = Object.keys(state.objectsById)
|
||||||
for (const id in state.objectsById) {
|
.filter(id => state.d2.activeShape === id || selectedObjects.indexOf(id) !== -1);
|
||||||
if (state.d2.activeShape === id) {
|
|
||||||
activeShapes[id] = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (activeTransformer && !state.objectsById[id].solid) {
|
|
||||||
activeShapes[id] = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
activeShapes[id] = selectedObjects.includes(id) && activeTransformer;
|
|
||||||
}
|
|
||||||
return activeShapes;
|
return activeShapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user