Skip to content

Commit 4126adf

Browse files
authored
Merge pull request #203 from plotly/feature-wheel-sensivity
Feature wheel sensitivity
2 parents 43433b0 + 169e0cd commit 4126adf

20 files changed

+99
-17
lines changed

R/cytoCytoscape.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# AUTO GENERATED FILE - DO NOT EDIT
22

33
#' @export
4-
cytoCytoscape <- function(id=NULL, autoRefreshLayout=NULL, autolock=NULL, autoungrabify=NULL, autounselectify=NULL, boxSelectionEnabled=NULL, className=NULL, clearOnUnhover=NULL, contextMenu=NULL, contextMenuData=NULL, elements=NULL, extent=NULL, generateImage=NULL, imageData=NULL, layout=NULL, maxZoom=NULL, minZoom=NULL, mouseoverEdgeData=NULL, mouseoverNodeData=NULL, pan=NULL, panningEnabled=NULL, responsive=NULL, selectedEdgeData=NULL, selectedNodeData=NULL, style=NULL, stylesheet=NULL, tapEdge=NULL, tapEdgeData=NULL, tapNode=NULL, tapNodeData=NULL, userPanningEnabled=NULL, userZoomingEnabled=NULL, zoom=NULL, zoomingEnabled=NULL) {
4+
cytoCytoscape <- function(id=NULL, autoRefreshLayout=NULL, autolock=NULL, autoungrabify=NULL, autounselectify=NULL, boxSelectionEnabled=NULL, className=NULL, clearOnUnhover=NULL, contextMenu=NULL, contextMenuData=NULL, elements=NULL, extent=NULL, generateImage=NULL, imageData=NULL, layout=NULL, maxZoom=NULL, minZoom=NULL, mouseoverEdgeData=NULL, mouseoverNodeData=NULL, pan=NULL, panningEnabled=NULL, responsive=NULL, selectedEdgeData=NULL, selectedNodeData=NULL, style=NULL, stylesheet=NULL, tapEdge=NULL, tapEdgeData=NULL, tapNode=NULL, tapNodeData=NULL, userPanningEnabled=NULL, userZoomingEnabled=NULL, wheelSensitivity=NULL, zoom=NULL, zoomingEnabled=NULL) {
55

6-
props <- list(id=id, autoRefreshLayout=autoRefreshLayout, autolock=autolock, autoungrabify=autoungrabify, autounselectify=autounselectify, boxSelectionEnabled=boxSelectionEnabled, className=className, clearOnUnhover=clearOnUnhover, contextMenu=contextMenu, contextMenuData=contextMenuData, elements=elements, extent=extent, generateImage=generateImage, imageData=imageData, layout=layout, maxZoom=maxZoom, minZoom=minZoom, mouseoverEdgeData=mouseoverEdgeData, mouseoverNodeData=mouseoverNodeData, pan=pan, panningEnabled=panningEnabled, responsive=responsive, selectedEdgeData=selectedEdgeData, selectedNodeData=selectedNodeData, style=style, stylesheet=stylesheet, tapEdge=tapEdge, tapEdgeData=tapEdgeData, tapNode=tapNode, tapNodeData=tapNodeData, userPanningEnabled=userPanningEnabled, userZoomingEnabled=userZoomingEnabled, zoom=zoom, zoomingEnabled=zoomingEnabled)
6+
props <- list(id=id, autoRefreshLayout=autoRefreshLayout, autolock=autolock, autoungrabify=autoungrabify, autounselectify=autounselectify, boxSelectionEnabled=boxSelectionEnabled, className=className, clearOnUnhover=clearOnUnhover, contextMenu=contextMenu, contextMenuData=contextMenuData, elements=elements, extent=extent, generateImage=generateImage, imageData=imageData, layout=layout, maxZoom=maxZoom, minZoom=minZoom, mouseoverEdgeData=mouseoverEdgeData, mouseoverNodeData=mouseoverNodeData, pan=pan, panningEnabled=panningEnabled, responsive=responsive, selectedEdgeData=selectedEdgeData, selectedNodeData=selectedNodeData, style=style, stylesheet=stylesheet, tapEdge=tapEdge, tapEdgeData=tapEdgeData, tapNode=tapNode, tapNodeData=tapNodeData, userPanningEnabled=userPanningEnabled, userZoomingEnabled=userZoomingEnabled, wheelSensitivity=wheelSensitivity, zoom=zoom, zoomingEnabled=zoomingEnabled)
77
if (length(props) > 0) {
88
props <- props[!vapply(props, is.null, logical(1))]
99
}
1010
component <- list(
1111
props = props,
1212
type = 'Cytoscape',
1313
namespace = 'dash_cytoscape',
14-
propNames = c('id', 'autoRefreshLayout', 'autolock', 'autoungrabify', 'autounselectify', 'boxSelectionEnabled', 'className', 'clearOnUnhover', 'contextMenu', 'contextMenuData', 'elements', 'extent', 'generateImage', 'imageData', 'layout', 'maxZoom', 'minZoom', 'mouseoverEdgeData', 'mouseoverNodeData', 'pan', 'panningEnabled', 'responsive', 'selectedEdgeData', 'selectedNodeData', 'style', 'stylesheet', 'tapEdge', 'tapEdgeData', 'tapNode', 'tapNodeData', 'userPanningEnabled', 'userZoomingEnabled', 'zoom', 'zoomingEnabled'),
14+
propNames = c('id', 'autoRefreshLayout', 'autolock', 'autoungrabify', 'autounselectify', 'boxSelectionEnabled', 'className', 'clearOnUnhover', 'contextMenu', 'contextMenuData', 'elements', 'extent', 'generateImage', 'imageData', 'layout', 'maxZoom', 'minZoom', 'mouseoverEdgeData', 'mouseoverNodeData', 'pan', 'panningEnabled', 'responsive', 'selectedEdgeData', 'selectedNodeData', 'style', 'stylesheet', 'tapEdge', 'tapEdgeData', 'tapNode', 'tapNodeData', 'userPanningEnabled', 'userZoomingEnabled', 'wheelSensitivity', 'zoom', 'zoomingEnabled'),
1515
package = 'dashCytoscape'
1616
)
1717

dash_cytoscape/Cytoscape.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ class attribute).
498498
Whether user events (e.g. dragging the graph background) are
499499
allowed to pan the graph.
500500
501+
- wheelSensitivity (number; default 1):
502+
Changes the scroll wheel sensitivity when zooming.
503+
501504
- zoom (number; default 1):
502505
The initial zoom level of the graph. You can set `minZoom` and
503506
`maxZoom` to set restrictions on the zoom level.
@@ -530,6 +533,7 @@ def __init__(
530533
maxZoom=Component.UNDEFINED,
531534
zoomingEnabled=Component.UNDEFINED,
532535
userZoomingEnabled=Component.UNDEFINED,
536+
wheelSensitivity=Component.UNDEFINED,
533537
boxSelectionEnabled=Component.UNDEFINED,
534538
autoungrabify=Component.UNDEFINED,
535539
autolock=Component.UNDEFINED,
@@ -583,6 +587,7 @@ def __init__(
583587
"tapNodeData",
584588
"userPanningEnabled",
585589
"userZoomingEnabled",
590+
"wheelSensitivity",
586591
"zoom",
587592
"zoomingEnabled",
588593
]
@@ -620,6 +625,7 @@ def __init__(
620625
"tapNodeData",
621626
"userPanningEnabled",
622627
"userZoomingEnabled",
628+
"wheelSensitivity",
623629
"zoom",
624630
"zoomingEnabled",
625631
]

dash_cytoscape/dash_cytoscape.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape_extra.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/dash_cytoscape_extra.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_cytoscape/metadata.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@
558558
"computed": false
559559
}
560560
},
561+
"wheelSensitivity": {
562+
"type": {
563+
"name": "number"
564+
},
565+
"required": false,
566+
"description": "Changes the scroll wheel sensitivity when zooming.",
567+
"defaultValue": {
568+
"value": "1",
569+
"computed": false
570+
}
571+
},
561572
"boxSelectionEnabled": {
562573
"type": {
563574
"name": "bool"
File renamed without changes.

demos/usage-wheel-sensitivity.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import dash
2+
from dash import html
3+
import dash_cytoscape as cyto
4+
5+
app = dash.Dash(__name__)
6+
server = app.server
7+
8+
elements = [
9+
{"data": {"id": "Node 1", "label": "Node 1"}, "position": {"x": 0, "y": 0}},
10+
{"data": {"id": "Node 2", "label": "Node 2"}, "position": {"x": 50, "y": 50}},
11+
{"data": {"source": "Node 1", "target": "Node 2", "label": ""}},
12+
]
13+
14+
15+
app.layout = html.Div(
16+
[
17+
html.Div(
18+
[
19+
html.H1("Low wheel sensitivity (0.01)"),
20+
cyto.Cytoscape(
21+
id="cytoscape-slow",
22+
elements=elements,
23+
wheelSensitivity=0.01,
24+
),
25+
]
26+
),
27+
html.Div(
28+
[
29+
html.H1("Default wheel sensitivity (1)"),
30+
cyto.Cytoscape(
31+
id="cytoscape-normal",
32+
elements=elements,
33+
wheelSensitivity=1,
34+
),
35+
]
36+
),
37+
html.Div(
38+
[
39+
html.H1("High wheel sensitivity (100)"),
40+
cyto.Cytoscape(
41+
id="cytoscape-fast",
42+
elements=elements,
43+
wheelSensitivity=100,
44+
),
45+
]
46+
),
47+
],
48+
style={"display": "flex"},
49+
)
50+
51+
52+
if __name__ == "__main__":
53+
app.run_server(debug=True)

deps/dash_cytoscape.dev.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)