MCPcopy Index your code
hub / github.com/plotly/plotly.js / sync

Function sync

src/plots/geo/zoom.js:39–66  ·  view source on GitHub ↗
(geo, projection, cb)

Source from the content-addressed store, hash-verified

37
38// sync zoom updates with user & full layout
39function sync(geo, projection, cb) {
40 var id = geo.id;
41 var gd = geo.graphDiv;
42 var layout = gd.layout;
43 var userOpts = layout[id];
44 var fullLayout = gd._fullLayout;
45 var fullOpts = fullLayout[id];
46
47 var preGUI = {};
48 var eventData = {};
49
50 function set(propStr, val) {
51 preGUI[id + '.' + propStr] = Lib.nestedProperty(userOpts, propStr).get();
52 Registry.call('_storeDirectGUIEdit', layout, fullLayout._preGUI, preGUI);
53
54 var fullNp = Lib.nestedProperty(fullOpts, propStr);
55 if(fullNp.get() !== val) {
56 fullNp.set(val);
57 Lib.nestedProperty(userOpts, propStr).set(val);
58 eventData[id + '.' + propStr] = val;
59 }
60 }
61
62 cb(set);
63 set('projection.scale', projection.scale() / geo.fitScale);
64 set('fitbounds', false);
65 gd.emit('plotly_relayout', eventData);
66}
67
68// zoom for scoped projections
69function zoomScoped(geo, projection) {

Callers 2

handleZoomendFunction · 0.85
zoomClippedFunction · 0.85

Calls 1

setFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…