forked from LGSInnovations/react-sigplot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayer.js
45 lines (38 loc) · 1.25 KB
/
layer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { Component } from 'react'; // eslint-disable-line no-unused-vars
import PropTypes from 'prop-types';
import { PlotContext } from './sigplot';
/**
* Abstract base class for all Layers
*/
class Layer extends Component {
static propTypes = {
/** Array of `Number` types */
data: PropTypes.arrayOf(PropTypes.number), // eslint-disable-line react/no-unused-prop-types
/** Header options for `data` */
options: PropTypes.object, // eslint-disable-line react/no-unused-prop-types
/**
* Options about the layer
*
* @see See [sigplot.layer1d](https://github.com/LGSInnovations/sigplot/blob/master/js/sigplot.layer1d.js)
* @see See [sigplot.layer2d](https://github.com/LGSInnovations/sigplot/blob/master/js/sigplot.layer2d.js)
*/
layerOptions: PropTypes.object, // eslint-disable-line react/no-unused-prop-types
};
static contextType = PlotContext;
/**
* On unmount, all we need to do is remove the layer
* from the plot.
*/
componentWillUnmount() {
this.context.remove_layer(this.layer);
}
/**
* The layer components don't _actually_ render to the DOM.
*
* They are merely abstractions of canvas-manipulations.
*/
render() {
return false;
}
}
export default Layer;