Skip to content

Commit

Permalink
eslint stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Nov 28, 2019
1 parent 7e00f30 commit 4b0511a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
35 changes: 20 additions & 15 deletions lib/plots/canopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import etch from 'etch';
import { prewalk, postwalk, prefor } from './tree.js';
import { Etch, Tip, Button, toView } from '../util/etch.js';
import { Etch, Button, toView } from '../util/etch.js';

function clamp (x, min, max) {
return Math.min(Math.max(x, min), max)
Expand All @@ -26,12 +26,12 @@ function dims(tree) {
left += ch.width;
});
// Centre align children
chwidth = parent.children.map(({width})=>width).reduce((a,b)=>a+b, 0);
const chwidth = parent.children.map(({width})=>width).reduce((a,b)=>a+b, 0);
parent.children.forEach(ch => ch.left += (parent.width-chwidth)/2);
return parent;
});
// Scale total height to 100%
let max = postwalk(tree, ({height, children}) =>
const max = postwalk(tree, ({height, children}) =>
Math.max(height, ...children.map(x=>x+height)));
prewalk(tree, (node) => {
node.top /= max;
Expand Down Expand Up @@ -172,7 +172,7 @@ export class Pannable extends Etch {
this.toolbar = this.toolbar.concat(this.item.toolbar)
}

let style = {position:'relative', height:'inherit', width:'inherit', transformOrigin: '0px 0px'}
const style = { position:'relative', height:'inherit', width:'inherit', transformOrigin: '0px 0px' }

if (this.zoomstrategy == 'width') {
style.transform = 'translate('+this.left+'px,'+this.top+'px)'
Expand Down Expand Up @@ -214,22 +214,27 @@ export class Pannable extends Etch {

class NodeView extends Etch {
render() {
let {height, width, top, left, onclick, onmouseover, onmouseout} = this.props;
return <Clickable onclick={onclick}><div className='node' {...{onmouseover, onmouseout}} style={{
height: 100*height+'%',
width: 100*width +'%',
top: 100*top +'%',
left: 100*left +'%'
}}>
<div><div></div></div>
</div></Clickable>;
const { height, width, top, left, onclick, onmouseover, onmouseout } = this.props;
return <Clickable onclick={onclick}>
<div className='node' {...{onmouseover, onmouseout}} style={{
height: 100*height+'%',
width: 100*width +'%',
top: 100*top +'%',
left: 100*left +'%'
}}>
<div>
<div>
</div>
</div>
</div>
</Clickable>;
}
}

export default class Canopy extends Etch {
update({data}) {}
update({ data }) {}
render() {
let nodes = [];
const nodes = [];
prefor(dims(this.props.data), node => nodes.push(<NodeView {...node} />));
return <div className="ink-canopy">
{nodes}
Expand Down
1 change: 0 additions & 1 deletion lib/util/etch.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export class Tip {
this.tooltip = atom.tooltips.add(this.element, {title: () => this.text});
}


this.text = alt;
this.child = child;
etch.update(this, false);
Expand Down

0 comments on commit 4b0511a

Please sign in to comment.