mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +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;
|
||||
}
|
||||
|
||||
if (!this._shapeData || this._shapeData.solid !== shapeData.solid) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
this._shapeData = shapeData;
|
||||
return changed;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { shapeDataToShape, determineActiveShape } from '../shape/shapeDataUtils.js';
|
||||
import { shapeDataToShape, determineActiveShape2d } from '../shape/shapeDataUtils.js';
|
||||
// import R from 'ramda';
|
||||
|
||||
export default class ShapesManager {
|
||||
@ -15,7 +15,7 @@ export default class ShapesManager {
|
||||
const needRender = { active: false, inactive: false };
|
||||
|
||||
// determine if shape is "active", meaning it will be updated frequently
|
||||
const activeShapes = determineActiveShape(state);
|
||||
const activeShapes = determineActiveShape2d(state);
|
||||
|
||||
const { objectsById } = state;
|
||||
|
||||
|
@ -70,27 +70,11 @@ function shapeDataToShapeRaw(shapeData) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO can maybe be memoized
|
||||
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;
|
||||
|
||||
export const determineActiveShape2d = (state) => {
|
||||
const selectedObjects = state.selection.objects.map(({ id }) => id);
|
||||
const activeShapes = {};
|
||||
for (const id in state.objectsById) {
|
||||
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;
|
||||
}
|
||||
const activeShapes = Object.keys(state.objectsById)
|
||||
.filter(id => state.d2.activeShape === id || selectedObjects.indexOf(id) !== -1);
|
||||
|
||||
return activeShapes;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user