mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-11-05 06:03:24 +01:00
linter
This commit is contained in:
parent
b674769ef8
commit
1b66fc21e0
@ -45,7 +45,7 @@ class DoodlePreview extends React.Component {
|
||||
scene: null
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
async componentWillMount() {
|
||||
let { docData, sketchData } = this.props;
|
||||
|
||||
if (docData) sketchData = await JSONToSketchData(this.props.docData);
|
||||
|
@ -1,7 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import initialMenuStructure from '../constants/menu.js';
|
||||
import { connect } from 'react-redux';
|
||||
// import createDebug from 'debug';
|
||||
// const debug = createDebug('d3d:menu');
|
||||
|
||||
@ -14,7 +12,7 @@ class Menu extends React.Component {
|
||||
value: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
stateMenu: PropTypes.object
|
||||
id: PropTypes.string
|
||||
};
|
||||
onSelect = (event) => {
|
||||
const { onSelect, value } = this.props;
|
||||
@ -23,7 +21,7 @@ class Menu extends React.Component {
|
||||
if (onSelect) onSelect({ ...event, menuValue });
|
||||
};
|
||||
render() {
|
||||
const { className = '', id, selectedValue, onOpen, onClose, value, children, stateMenu } = this.props;
|
||||
const { className = '', id, selectedValue, onOpen, onClose, children } = this.props;
|
||||
return (
|
||||
<ul id={id} className={`menu ${className}`}>
|
||||
{React.Children.map(children, (child) => {
|
||||
@ -39,6 +37,4 @@ class Menu extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(state => ({
|
||||
stateMenu: state.sketcher.present.menus
|
||||
}))(Menu);
|
||||
export default Menu;
|
||||
|
@ -234,13 +234,19 @@ const getMenus = createSelector([
|
||||
state => state.sketcher.present.menus,
|
||||
state => state.sketcher.present.d2.tool,
|
||||
state => state.sketcher.present.selection.objects.length,
|
||||
state => state.sketcher.present.selection.objects.filter(({ id }) => state.sketcher.present.objectsById[id].fill).length,
|
||||
state => state.sketcher.present.selection.objects.filter(({ id }) => state.sketcher.present.objectsById[id].solid).length,
|
||||
state => state.sketcher.present.selection.objects.some(({ id }) => state.sketcher.present.objectsById[id].type === 'TEXT')
|
||||
], (menus, activeTool, numSelectedObjects, numFilledObjects, numSolidObjects, selectionIncludesText) => ({
|
||||
toolbar2d: filterMenus(activeTool, numSelectedObjects, numFilledObjects, numSolidObjects, selectionIncludesText, nestChildren(menus, menus[TOOLBAR2D])),
|
||||
toolbar3d: filterMenus(activeTool, numSelectedObjects, numFilledObjects, numSolidObjects, selectionIncludesText, nestChildren(menus, menus[TOOLBAR3D])),
|
||||
context: filterMenus(activeTool, numSelectedObjects, numFilledObjects, numSolidObjects, selectionIncludesText, nestChildren(menus, menus[CONTEXT]))
|
||||
state => state.sketcher.present.selection.objects.filter(({ id }) => {
|
||||
return state.sketcher.present.objectsById[id].fill;
|
||||
}).length,
|
||||
state => state.sketcher.present.selection.objects.filter(({ id }) => {
|
||||
return state.sketcher.present.objectsById[id].solid;
|
||||
}).length,
|
||||
state => state.sketcher.present.selection.objects.some(({ id }) => {
|
||||
return state.sketcher.present.objectsById[id].type === 'TEXT';
|
||||
})
|
||||
], (menus, ...args) => ({
|
||||
toolbar2d: filterMenus(...args, nestChildren(menus, menus[TOOLBAR2D])),
|
||||
toolbar3d: filterMenus(...args, nestChildren(menus, menus[TOOLBAR3D])),
|
||||
context: filterMenus(...args, nestChildren(menus, menus[CONTEXT]))
|
||||
}));
|
||||
|
||||
export default injectSheet(styles)(connect(getMenus)(SketcherToolbars));
|
||||
|
@ -67,7 +67,9 @@ class SubMenu extends React.Component {
|
||||
}
|
||||
};
|
||||
render() {
|
||||
const { id, value, selected, open, selectedValue, children, svg, toggleBehavior, color, solid } = this.props;
|
||||
const {
|
||||
id, value, selected, open, selectedValue, children, svg, toggleBehavior, color, solid
|
||||
} = this.props;
|
||||
|
||||
const style = {};
|
||||
if (id === 'color-picker-tool') {
|
||||
|
@ -65,7 +65,9 @@ export default class EventGroup extends Group {
|
||||
if (event.event) gestureEvent.position = _convertEvent(event.event);
|
||||
if (event.events) gestureEvent.positions = event.events.map(_convertEvent);
|
||||
if (event.preEvents) gestureEvent.preDrags = event.preEvents.map(_convertEvent);
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
if (event.event && event.event.deltaY !== undefined) {
|
||||
gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
}
|
||||
|
||||
this.onEvent(gestureEvent);
|
||||
}
|
||||
|
@ -58,24 +58,6 @@ export default class PolygonTool extends BaseTool {
|
||||
context.restore();
|
||||
|
||||
context.beginPath();
|
||||
|
||||
// const anglePosition = this.anglePosition.applyMatrix(matrix);
|
||||
// context.arc(anglePosition.x, anglePosition.y, 20, 0, this.angleDegrees, this.angleDegrees > Math.PI);
|
||||
//
|
||||
// context.strokeStyle = 'black';
|
||||
// context.lineWidth = 1;
|
||||
// context.stroke();
|
||||
//
|
||||
// const angleTextPos = new Vector(28, 0)
|
||||
// .rotate((this.angleDegrees < Math.PI ? this.angleDegrees : this.angleDegrees - Math.PI * 2.0) / 2)
|
||||
// .add(anglePosition);
|
||||
// context.textAlign = 'start';
|
||||
// context.textBaseline = 'middle';
|
||||
// context.fillStyle = '#000';
|
||||
// context.font = '10px Arial';
|
||||
//
|
||||
// const angleDegrees = this.angleDegrees < Math.PI ? this.angleDegrees : Math.PI * 2 - this.angleDegrees;
|
||||
// dimensionsText.drawText(context, humanReadable.degrees(angleDegrees), angleTextPos.x, angleTextPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
src/d3/EventScene.js
vendored
4
src/d3/EventScene.js
vendored
@ -42,7 +42,9 @@ export class EventScene extends THREE.Scene {
|
||||
if (event.event) gestureEvent.position = _convertEvent(event.event);
|
||||
if (event.events) gestureEvent.positions = event.events.map(_convertEvent);
|
||||
if (event.preEvents) gestureEvent.preDrags = event.preEvents.map(_convertEvent);
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
if (event.event && event.event.deltaY !== undefined) {
|
||||
gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
}
|
||||
|
||||
this.onEvent(gestureEvent);
|
||||
};
|
||||
|
2
src/d3/ShapeMesh.js
vendored
2
src/d3/ShapeMesh.js
vendored
@ -21,7 +21,7 @@ class ShapeMesh extends THREE.Object3D {
|
||||
super();
|
||||
this.name = shapeData.UID;
|
||||
|
||||
const { sculpt, rotate, twist, height, type, transform, z, color, fill, solid } = shapeData;
|
||||
const { sculpt, rotate, twist, height, type, transform, z, color, solid } = shapeData;
|
||||
|
||||
const material = new MatcapMaterial({ color: new THREE.Color(color) });
|
||||
|
||||
|
2
src/d3/effects/AnaglyphPass.js
vendored
2
src/d3/effects/AnaglyphPass.js
vendored
@ -55,7 +55,7 @@ export default class AnaglyphPass {
|
||||
this._renderTargetR.setSize(width * pixelRatio, height * pixelRatio);
|
||||
}
|
||||
|
||||
render(renderer, writeBuffer, readBuffer, delta, maskActive) {
|
||||
render(renderer, writeBuffer, readBuffer) {
|
||||
this.scene.updateMatrixWorld();
|
||||
this._stereo.update(this.camera);
|
||||
|
||||
|
6
src/d3/effects/RenderPass.js
vendored
6
src/d3/effects/RenderPass.js
vendored
@ -1,5 +1,3 @@
|
||||
import * as THREE from 'three';
|
||||
|
||||
export default class RenderPass {
|
||||
constructor(scene, camera, callbackBeforeRender) {
|
||||
this.scene = scene;
|
||||
@ -10,10 +8,10 @@ export default class RenderPass {
|
||||
this.renderToScreen = false;
|
||||
}
|
||||
|
||||
setSize(width, height) {
|
||||
setSize() {
|
||||
}
|
||||
|
||||
render(renderer, writeBuffer, readBuffer, delta, maskActive) {
|
||||
render(renderer, writeBuffer, readBuffer) {
|
||||
if (this._callbackBeforeRender) this._callbackBeforeRender();
|
||||
|
||||
let oldAutoClear;
|
||||
|
1
src/d3/transformers/StampTransformer.js
vendored
1
src/d3/transformers/StampTransformer.js
vendored
@ -1,5 +1,4 @@
|
||||
import { CANVAS_SIZE } from '../../constants/d2Constants';
|
||||
import ShapeMesh from '../ShapeMesh.js';
|
||||
import * as THREE from 'three';
|
||||
import BaseTransformer from './BaseTransformer.js';
|
||||
import * as actions from '../../actions/index.js';
|
||||
|
@ -1,5 +1,4 @@
|
||||
import update from 'react-addons-update';
|
||||
import { Matrix } from 'cal';
|
||||
import constrainMatrix from './constrainMatrix.js';
|
||||
import { calculateGestureMatrix } from '../../utils/matrixUtils.js';
|
||||
import * as actions from '../../actions/index.js';
|
||||
|
@ -31,5 +31,8 @@ function handleEraser(state, path, screenMatrixZoom) {
|
||||
roundPrecision: 0.25
|
||||
});
|
||||
|
||||
return subtractShapeFromState(state, eraserShape, d2Tools.ERASER, { matrix: screenMatrixZoom, scale: CLIPPER_PRECISION });
|
||||
return subtractShapeFromState(state, eraserShape, d2Tools.ERASER, {
|
||||
matrix: screenMatrixZoom,
|
||||
scale: CLIPPER_PRECISION
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { updateColor } from '../../selectionReducer.js';
|
||||
import { getColor } from '../../../utils/objectSelectors.js';
|
||||
import { select } from '../../menusReducer.js';
|
||||
import update from 'react-addons-update';
|
||||
import { updateTool as updateTool2d } from '../toolReducer.js';
|
||||
|
||||
export default function pipetteReducer(state, action) {
|
||||
|
Loading…
Reference in New Issue
Block a user