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

Function makeEditable

src/components/colorbar/draw.js:857–900  ·  view source on GitHub ↗
(g, opts, gd)

Source from the content-addressed store, hash-verified

855}
856
857function makeEditable(g, opts, gd) {
858 var isVertical = opts.orientation === 'v';
859 var fullLayout = gd._fullLayout;
860 var gs = fullLayout._size;
861 var t0, xf, yf;
862
863 dragElement.init({
864 element: g.node(),
865 gd: gd,
866 prepFn: function() {
867 t0 = g.attr('transform');
868 setCursor(g);
869 },
870 moveFn: function(dx, dy) {
871 g.attr('transform', t0 + strTranslate(dx, dy));
872
873 xf = dragElement.align(
874 (isVertical ? opts._uFrac : opts._vFrac) + (dx / gs.w),
875 isVertical ? opts._thickFrac : opts._lenFrac,
876 0, 1, opts.xanchor);
877 yf = dragElement.align(
878 (isVertical ? opts._vFrac : (1 - opts._uFrac)) - (dy / gs.h),
879 isVertical ? opts._lenFrac : opts._thickFrac,
880 0, 1, opts.yanchor);
881
882 var csr = dragElement.getCursor(xf, yf, opts.xanchor, opts.yanchor);
883 setCursor(g, csr);
884 },
885 doneFn: function() {
886 setCursor(g);
887
888 if(xf !== undefined && yf !== undefined) {
889 var update = {};
890 update[opts._propPrefix + 'x'] = xf;
891 update[opts._propPrefix + 'y'] = yf;
892 if(opts._traceIndex !== undefined) {
893 Registry.call('_guiRestyle', gd, update, opts._traceIndex);
894 } else {
895 Registry.call('_guiRelayout', gd, update);
896 }
897 }
898 }
899 });
900}
901
902function calcLevels(gd, opts, zrange) {
903 var levelsIn = opts._levels;

Callers 1

drawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…