Skip to content

Commit a494a89

Browse files
committed
lib: use queue length set via setPlotConfig
- use a default of 0 (i.e. turned off the queue by default)
1 parent 8a141ea commit a494a89

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/lib/queue.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
'use strict';
1111

1212
var Lib = require('../lib');
13+
var config = require('../plot_api/plot_config');
14+
1315

1416
/**
1517
* Copy arg array *without* removing `undefined` values from objects.
@@ -45,8 +47,6 @@ function copyArgArray(gd, args) {
4547

4648
var queue = {};
4749

48-
var maxElementCount = 10;
49-
5050
// TODO: disable/enable undo and redo buttons appropriately
5151

5252
/**
@@ -89,7 +89,7 @@ queue.add = function(gd, undoFunc, undoArgs, redoFunc, redoArgs) {
8989
queueObj.redo.calls.push(redoFunc);
9090
queueObj.redo.args.push(redoArgs);
9191

92-
if(gd.undoQueue.queue.length > maxElementCount) {
92+
if(gd.undoQueue.queue.length > config.queueLength) {
9393
gd.undoQueue.queue.shift();
9494
gd.undoQueue.index--;
9595
}

src/plot_api/plot_config.js

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ module.exports = {
2626
// we can edit titles, move annotations, etc
2727
editable: false,
2828

29+
// set the length of the undo/redo queue
30+
queueLength: 0,
31+
2932
// plot will respect layout.autosize=true and infer its container size
3033
autosizable: false,
3134

0 commit comments

Comments
 (0)