mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 19:13:49 +01:00
parent
2a7625218f
commit
af9c06749c
10
src/d3/ShapesManager.js
vendored
10
src/d3/ShapesManager.js
vendored
@ -48,7 +48,7 @@ export default class ShapesManager extends THREE.Object3D {
|
|||||||
if (this._state) {
|
if (this._state) {
|
||||||
for (const id in this._state.objectsById) {
|
for (const id in this._state.objectsById) {
|
||||||
if (!state.objectsById[id]) {
|
if (!state.objectsById[id]) {
|
||||||
if (!this._meshes[id].mesh._shapeData.solid) holesChanged = true;
|
if (this._state.objectsById[id].solid) holesChanged = true;
|
||||||
this._handleShapeRemove(id);
|
this._handleShapeRemove(id);
|
||||||
render = true;
|
render = true;
|
||||||
}
|
}
|
||||||
@ -82,7 +82,9 @@ export default class ShapesManager extends THREE.Object3D {
|
|||||||
this._holes = null;
|
this._holes = null;
|
||||||
for (let i = 0; i < ids.length; i ++) {
|
for (let i = 0; i < ids.length; i ++) {
|
||||||
const id = ids[i];
|
const id = ids[i];
|
||||||
if (!state.objectsById[id].solid) {
|
const { solid, type } = state.objectsById[id];
|
||||||
|
const d3Visible = SHAPE_TYPE_PROPERTIES[type].D3Visible;
|
||||||
|
if (!solid && d3Visible) {
|
||||||
const hole = this._meshes[id].mesh._mesh;
|
const hole = this._meshes[id].mesh._mesh;
|
||||||
const holeGeometry = new THREE.Geometry().fromBufferGeometry(hole.geometry);
|
const holeGeometry = new THREE.Geometry().fromBufferGeometry(hole.geometry);
|
||||||
const holeBSP = new THREE_BSP(holeGeometry);
|
const holeBSP = new THREE_BSP(holeGeometry);
|
||||||
@ -99,7 +101,9 @@ export default class ShapesManager extends THREE.Object3D {
|
|||||||
for (let i = 0; i < ids.length; i ++) {
|
for (let i = 0; i < ids.length; i ++) {
|
||||||
const id = ids[i];
|
const id = ids[i];
|
||||||
const active = activeShapes[id];
|
const active = activeShapes[id];
|
||||||
if (!active && state.objectsById[id].solid) {
|
const { solid, type } = state.objectsById[id];
|
||||||
|
const d3Visible = SHAPE_TYPE_PROPERTIES[type].D3Visible;
|
||||||
|
if (!active && solid && d3Visible) {
|
||||||
const shape = this._meshes[id].mesh;
|
const shape = this._meshes[id].mesh;
|
||||||
if (shape.updateHoleGeometry(this._holes)) {
|
if (shape.updateHoleGeometry(this._holes)) {
|
||||||
render = true;
|
render = true;
|
||||||
|
@ -2,6 +2,7 @@ import update from 'react-addons-update';
|
|||||||
import * as contextTools from '../constants/contextTools.js';
|
import * as contextTools from '../constants/contextTools.js';
|
||||||
import { COLOR_STRING_TO_HEX, COLOR_HEX_TO_STRING } from '../constants/general.js';
|
import { COLOR_STRING_TO_HEX, COLOR_HEX_TO_STRING } from '../constants/general.js';
|
||||||
import { ERASER_SIZES, BRUSH_SIZES } from '../constants/d2Constants.js';
|
import { ERASER_SIZES, BRUSH_SIZES } from '../constants/d2Constants.js';
|
||||||
|
import { SHAPE_TYPE_PROPERTIES } from '../constants/shapeTypeProperties.js';
|
||||||
import * as actions from '../actions/index.js';
|
import * as actions from '../actions/index.js';
|
||||||
import { select } from './menusReducer.js';
|
import { select } from './menusReducer.js';
|
||||||
import { getSelectedObjectsSelector, getBoundingBox } from '../utils/selectionUtils.js';
|
import { getSelectedObjectsSelector, getBoundingBox } from '../utils/selectionUtils.js';
|
||||||
@ -102,7 +103,9 @@ export default function (state, action) {
|
|||||||
|
|
||||||
return update(state, {
|
return update(state, {
|
||||||
objectsById: state.selection.objects.reduce((updateObject, { id }) => {
|
objectsById: state.selection.objects.reduce((updateObject, { id }) => {
|
||||||
updateObject[id] = { fill: { $set: fill } };
|
const { type } = state.objectsById[id];
|
||||||
|
const d3Visible = SHAPE_TYPE_PROPERTIES[type].D3Visible;
|
||||||
|
if (d3Visible) updateObject[id] = { fill: { $set: fill } };
|
||||||
return updateObject;
|
return updateObject;
|
||||||
}, {})
|
}, {})
|
||||||
});
|
});
|
||||||
@ -114,8 +117,9 @@ export default function (state, action) {
|
|||||||
|
|
||||||
return update(state, {
|
return update(state, {
|
||||||
objectsById: state.selection.objects.reduce((updateObject, { id }) => {
|
objectsById: state.selection.objects.reduce((updateObject, { id }) => {
|
||||||
const { fill } = state.objectsById[id];
|
const { fill, type } = state.objectsById[id];
|
||||||
if (fill) updateObject[id] = { solid: { $set: solid } };
|
const d3Visible = SHAPE_TYPE_PROPERTIES[type].D3Visible;
|
||||||
|
if (fill && d3Visible) updateObject[id] = { solid: { $set: solid } };
|
||||||
return updateObject;
|
return updateObject;
|
||||||
}, {})
|
}, {})
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user