pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/plotly/plotly.js/commit/049dc9a3abe990fbea2dfc55a975b3d347640212

link crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-9c8f61f9f58ad7b2.css" /> add config.editSelection option · plotly/plotly.js@049dc9a · GitHub
Skip to content

Commit 049dc9a

Browse files
committed
add config.editSelection option
1 parent 08f621b commit 049dc9a

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/components/selections/draw.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ function draw(gd) {
4646
}
4747
}
4848

49+
function couldHaveActiveSelection(gd) {
50+
return gd._context.editSelection;
51+
}
52+
4953
function drawOne(gd, index) {
5054
// remove the existing selection if there is one.
5155
// because indices can change, we need to look in all selection layers
@@ -82,7 +86,7 @@ function drawOne(gd, index) {
8286
lineDash = 'solid';
8387
}
8488

85-
var isActiveSelection =
89+
var isActiveSelection = couldHaveActiveSelection(gd) &&
8690
gd._fullLayout._activeSelectionIndex === index;
8791

8892
if(isActiveSelection) {
@@ -149,6 +153,8 @@ function setClipPath(selectionPath, gd, selectionOptions) {
149153

150154

151155
function activateSelection(gd, path) {
156+
if(!couldHaveActiveSelection(gd)) return;
157+
152158
var element = path.node();
153159
var id = +element.getAttribute('data-index');
154160
if(id >= 0) {
@@ -165,13 +171,17 @@ function activateSelection(gd, path) {
165171
}
166172

167173
function activateLastSelection(gd) {
174+
if(!couldHaveActiveSelection(gd)) return;
175+
168176
var id = gd._fullLayout.selections.length - 1;
169177
gd._fullLayout._activeSelectionIndex = id;
170178
gd._fullLayout._deactivateSelection = deactivateSelection;
171179
draw(gd);
172180
}
173181

174182
function deactivateSelection(gd) {
183+
if(!couldHaveActiveSelection(gd)) return;
184+
175185
var id = gd._fullLayout._activeSelectionIndex;
176186
if(id >= 0) {
177187
clearOutlineControllers(gd);

src/plot_api/plot_config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ var configAttributes = {
114114
}
115115
},
116116

117+
editSelection: {
118+
valType: 'boolean',
119+
dflt: true,
120+
description: 'Disables moving selections.'
121+
},
122+
117123
autosizable: {
118124
valType: 'boolean',
119125
dflt: false,

test/plot-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@
199199
"valType": "boolean"
200200
}
201201
},
202+
"editSelection": {
203+
"description": "Disables moving selections.",
204+
"dflt": true,
205+
"valType": "boolean"
206+
},
202207
"fillFrame": {
203208
"description": "When `layout.autosize` is turned on, determines whether the graph fills the container (the default) or the screen (if set to *true*).",
204209
"dflt": false,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy