Skip to content

Commit

Permalink
rm check for Plotly.Queue:
Browse files Browse the repository at this point in the history
  - Queue is now part of plotly.js and always there
  • Loading branch information
etpinard committed Nov 12, 2015
1 parent 9d2568d commit 94a450c
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,9 +1358,7 @@ Plotly.extendTraces = function extendTraces (gd, update, indices, maxPoints) {
Plotly.redraw(gd);

var undoArgs = [gd, undo.update, indices, undo.maxPoints];
if (Plotly.Queue) {
Plotly.Queue.add(gd, Plotly.prependTraces, undoArgs, extendTraces, arguments);
}
Plotly.Queue.add(gd, Plotly.prependTraces, undoArgs, extendTraces, arguments);
};

Plotly.prependTraces = function prependTraces (gd, update, indices, maxPoints) {
Expand All @@ -1385,9 +1383,7 @@ Plotly.prependTraces = function prependTraces (gd, update, indices, maxPoints)
Plotly.redraw(gd);

var undoArgs = [gd, undo.update, indices, undo.maxPoints];
if (Plotly.Queue) {
Plotly.Queue.add(gd, Plotly.extendTraces, undoArgs, prependTraces, arguments);
}
Plotly.Queue.add(gd, Plotly.extendTraces, undoArgs, prependTraces, arguments);
};

/**
Expand Down Expand Up @@ -1431,7 +1427,7 @@ Plotly.addTraces = function addTraces (gd, traces, newIndices) {
// i.e., we can simply redraw and be done
if (typeof newIndices === 'undefined') {
Plotly.redraw(gd);
if (Plotly.Queue) Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
return;
}

Expand All @@ -1454,10 +1450,10 @@ Plotly.addTraces = function addTraces (gd, traces, newIndices) {

// if we're here, the user has defined specific places to place the new traces
// this requires some extra work that moveTraces will do
if (Plotly.Queue) Plotly.Queue.startSequence(gd);
if (Plotly.Queue) Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
Plotly.Queue.startSequence(gd);
Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
Plotly.moveTraces(gd, currentIndices, newIndices);
if (Plotly.Queue) Plotly.Queue.stopSequence(gd);
Plotly.Queue.stopSequence(gd);
};

/**
Expand Down Expand Up @@ -1497,8 +1493,7 @@ Plotly.deleteTraces = function deleteTraces (gd, indices) {
}

Plotly.redraw(gd);

if (Plotly.Queue) Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
};

/**
Expand Down Expand Up @@ -1592,10 +1587,8 @@ Plotly.moveTraces = function moveTraces (gd, currentIndices, newIndices) {
}

gd.data = newData;

Plotly.redraw(gd);

if (Plotly.Queue) Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
Plotly.Queue.add(gd, undoFunc, undoArgs, redoFunc, redoArgs);
};

// -----------------------------------------------------
Expand Down Expand Up @@ -2032,9 +2025,7 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {

// now all attribute mods are done, as are redo and undo
// so we can save them
if(Plotly.Queue) {
Plotly.Queue.add(gd, restyle, [gd, undoit, traces], restyle, [gd, redoit, traces]);
}
Plotly.Queue.add(gd, restyle, [gd, undoit, traces], restyle, [gd, redoit, traces]);

// do we need to force a recalc?
var autorangeOn = false;
Expand Down Expand Up @@ -2412,9 +2403,7 @@ Plotly.relayout = function relayout(gd, astr, val) {
}
// now all attribute mods are done, as are
// redo and undo so we can save them
if(Plotly.Queue) {
Plotly.Queue.add(gd, relayout, [gd, undoit], relayout, [gd, redoit]);
}
Plotly.Queue.add(gd, relayout, [gd, undoit], relayout, [gd, redoit]);

// calculate autosizing - if size hasn't changed,
// will remove h&w so we don't need to redraw
Expand Down

1 comment on commit 94a450c

@etpinard
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queue is now attached and always included onto Plotly

Please sign in to comment.