scratch-paint/src/helper/layer.js

19 lines
466 B
JavaScript
Raw Normal View History

2017-09-11 14:23:30 -04:00
import paper from 'paper';
const getGuideLayer = function () {
for (let i = 0; i < paper.project.layers.length; i++) {
const layer = paper.project.layers[i];
if (layer.data && layer.data.isGuideLayer) {
return layer;
}
}
// Create if it doesn't exist
const guideLayer = new paper.Layer();
guideLayer.data.isGuideLayer = true;
guideLayer.bringToFront();
return guideLayer;
};
2017-09-13 15:17:59 -04:00
export {getGuideLayer};