Skip to content

Commit

Permalink
make annotations & shapes 'visible' -> 'plot' edit type
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Jul 27, 2018
1 parent f1cda60 commit 9a78013
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/components/annotations/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = templatedArray('annotation', {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc+arraydraw',
editType: 'plot+arraydraw',
description: [
'Determines whether or not this annotation is visible.'
].join(' ')
Expand Down
9 changes: 2 additions & 7 deletions src/components/annotations/calc_autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@ var draw = require('./draw').draw;


module.exports = function calcAutorange(gd) {
var fullLayout = gd._fullLayout;
var annotationList = Lib.filterVisible(fullLayout.annotations);

if(annotationList.length && gd._fullData.length) {
if(gd._fullLayout.annotations.length && gd._fullData.length) {
return Lib.syncOrAsync([draw, annAutorange], gd);
}
};

function annAutorange(gd) {
var fullLayout = gd._fullLayout;

// find the bounding boxes for each of these annotations'
// relative to their anchor points
// use the arrow and the text bg rectangle,
// as the whole anno may include hidden text in its bbox
Lib.filterVisible(fullLayout.annotations).forEach(function(ann) {
gd._fullLayout.annotations.forEach(function(ann) {
var xa = Axes.getFromId(gd, ann.xref);
var ya = Axes.getFromId(gd, ann.yref);

Expand Down
2 changes: 1 addition & 1 deletion src/components/shapes/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = templatedArray('shape', {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc+arraydraw',
editType: 'plot+arraydraw',
description: [
'Determines whether or not this shape is visible.'
].join(' ')
Expand Down
4 changes: 2 additions & 2 deletions src/components/shapes/calc_autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var helpers = require('./helpers');


module.exports = function calcAutorange(gd) {
var fullLayout = gd._fullLayout,
shapeList = Lib.filterVisible(fullLayout.shapes);
var fullLayout = gd._fullLayout;
var shapeList = fullLayout.shapes;

if(!shapeList.length || !gd._fullData.length) return;

Expand Down

0 comments on commit 9a78013

Please sign in to comment.