Fix importing images

#1
This commit is contained in:
casperlamboo 2017-11-23 10:38:01 +01:00
parent 2a7625218f
commit af9c06749c
2 changed files with 14 additions and 6 deletions

View File

@ -48,7 +48,7 @@ export default class ShapesManager extends THREE.Object3D {
if (this._state) {
for (const id in this._state.objectsById) {
if (!state.objectsById[id]) {
if (!this._meshes[id].mesh._shapeData.solid) holesChanged = true;
if (this._state.objectsById[id].solid) holesChanged = true;
this._handleShapeRemove(id);
render = true;
}
@ -82,7 +82,9 @@ export default class ShapesManager extends THREE.Object3D {
this._holes = null;
for (let i = 0; i < ids.length; 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 holeGeometry = new THREE.Geometry().fromBufferGeometry(hole.geometry);
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 ++) {
const id = ids[i];
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;
if (shape.updateHoleGeometry(this._holes)) {
render = true;

View File

@ -2,6 +2,7 @@ import update from 'react-addons-update';
import * as contextTools from '../constants/contextTools.js';
import { COLOR_STRING_TO_HEX, COLOR_HEX_TO_STRING } from '../constants/general.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 { select } from './menusReducer.js';
import { getSelectedObjectsSelector, getBoundingBox } from '../utils/selectionUtils.js';
@ -102,7 +103,9 @@ export default function (state, action) {
return update(state, {
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;
}, {})
});
@ -114,8 +117,9 @@ export default function (state, action) {
return update(state, {
objectsById: state.selection.objects.reduce((updateObject, { id }) => {
const { fill } = state.objectsById[id];
if (fill) updateObject[id] = { solid: { $set: solid } };
const { fill, type } = state.objectsById[id];
const d3Visible = SHAPE_TYPE_PROPERTIES[type].D3Visible;
if (fill && d3Visible) updateObject[id] = { solid: { $set: solid } };
return updateObject;
}, {})
});