comply with linter

This commit is contained in:
casperlamboo 2017-12-13 17:25:42 +01:00
parent 6dc871c320
commit d45df12f6f
6 changed files with 18 additions and 15 deletions

View File

@ -228,13 +228,13 @@ export function d3ChangeTool(tool) {
export function contextChangeTool(tool) { export function contextChangeTool(tool) {
return { type: CONTEXT_CHANGE_TOOL, tool }; return { type: CONTEXT_CHANGE_TOOL, tool };
} }
export function heightStart(handle) { export function changeHeightStart(handle) {
return { type: HEIGHT_START, handle }; return { type: HEIGHT_START, handle };
} }
export function height(delta) { export function changeHeight(delta) {
return { type: HEIGHT, delta, log: false }; return { type: HEIGHT, delta, log: false };
} }
export function heightEnd() { export function changeHeightEnd() {
return { type: HEIGHT_END }; return { type: HEIGHT_END };
} }
export function twistStart() { export function twistStart() {
@ -378,7 +378,10 @@ export function addImage(file) {
}).catch(error => { }).catch(error => {
URL.revokeObjectURL(url); URL.revokeObjectURL(url);
dispatch(notification.error({ position: 'tc', title: 'Error loading image, please try again with another image' })); dispatch(notification.error({
position: 'tc',
title: 'Error loading image, please try again with another image'
}));
throw error; // rethrow for other listeners throw error; // rethrow for other listeners
}); });

View File

@ -78,9 +78,9 @@ class App extends React.Component {
event.preventDefault(); event.preventDefault();
for (const file of event.dataTransfer.files) { for (const file of event.dataTransfer.files) {
const [name, ...extentions] = file.name.split('.'); const extentions = file.name.split('.').pop();
switch (extentions.pop().toUpperCase()) { switch (extentions.toUpperCase()) {
case 'D3SKETCH': case 'D3SKETCH':
case 'JSON': case 'JSON':
const url = URL.createObjectURL(file); const url = URL.createObjectURL(file);
@ -130,5 +130,5 @@ export default injectSheet(styles)(connect(null, {
undo: actions.undo.undo, undo: actions.undo.undo,
redo: actions.undo.redo, redo: actions.undo.redo,
openSketch: actions.openSketch, openSketch: actions.openSketch,
addImage: actions.addImage, addImage: actions.addImage
})(App)); })(App));

View File

@ -62,7 +62,8 @@ class D3Panel extends React.Component {
componentWillMount() { componentWillMount() {
this.createScene(); this.createScene();
this.renderChain = new RenderChain(this.renderer, this.scene, this.camera, hasExtensionsFor.toonShaderPreview, { const toonShader = hasExtensionsFor.hasExtensionsFor;
this.renderChain = new RenderChain(this.renderer, this.scene, this.camera, toonShader, {
UI: this.UIContainer, UI: this.UIContainer,
shapes: this.shapesManager, shapes: this.shapesManager,
boundingBox: this.selectionBox, boundingBox: this.selectionBox,

View File

@ -51,7 +51,6 @@ class DoodlePreview extends React.Component {
if (docData) sketchData = await JSONToSketchData(this.props.docData); if (docData) sketchData = await JSONToSketchData(this.props.docData);
const { canvas } = this.refs; const { canvas } = this.refs;
const { pixelRatio } = this.props
const sceneData = createSceneData(sketchData); const sceneData = createSceneData(sketchData);
@ -70,7 +69,7 @@ class DoodlePreview extends React.Component {
resizeHandler = (width, height) => { resizeHandler = (width, height) => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
const { setSize, render } = this.state; const { setSize } = this.state;
const { pixelRatio } = this.props; const { pixelRatio } = this.props;
setSize(width, height, pixelRatio); setSize(width, height, pixelRatio);
}); });

View File

@ -62,7 +62,7 @@ export default class RenderChain extends THREE.EffectComposer {
} }
} }
setSize(width, height, pixelRatio, rerender = true) { setSize(width, height, pixelRatio, render = true) {
this._renderer.setPixelRatio(pixelRatio); this._renderer.setPixelRatio(pixelRatio);
this._renderer.setSize(width, height); this._renderer.setSize(width, height);
super.setSize(width * pixelRatio, height * pixelRatio); super.setSize(width * pixelRatio, height * pixelRatio);
@ -70,7 +70,7 @@ export default class RenderChain extends THREE.EffectComposer {
this._camera.aspect = width / height; this._camera.aspect = width / height;
this._camera.updateProjectionMatrix(); this._camera.updateProjectionMatrix();
if (rerender) this.render(); if (render) this.render();
} }
render() { render() {

View File

@ -38,7 +38,7 @@ export default class HeightTransformer extends BaseTransformer {
dragStart(event) { dragStart(event) {
const handle = this.includesHandle(event.intersections); const handle = this.includesHandle(event.intersections);
if (handle) { if (handle) {
this.dispatch(actions.heightStart(handle)); this.dispatch(actions.changeHeightStart(handle));
} else { } else {
super.dragStart(event); super.dragStart(event);
} }
@ -47,7 +47,7 @@ export default class HeightTransformer extends BaseTransformer {
drag(event) { drag(event) {
if (this._active) { if (this._active) {
const delta = event.position.subtract(event.previousPosition); const delta = event.position.subtract(event.previousPosition);
this.dispatch(actions.height(delta)); this.dispatch(actions.changeHeight(delta));
} else { } else {
super.drag(event); super.drag(event);
} }
@ -55,7 +55,7 @@ export default class HeightTransformer extends BaseTransformer {
dragEnd(event) { dragEnd(event) {
if (this._active) { if (this._active) {
this.dispatch(actions.heightEnd()); this.dispatch(actions.changeHeightEnd());
} else { } else {
super.dragEnd(event); super.dragEnd(event);
} }