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

Function zoomPrep

src/plots/ternary/ternary.js:578–621  ·  view source on GitHub ↗
(e, startX, startY)

Source from the content-addressed store, hash-verified

576 }
577
578 function zoomPrep(e, startX, startY) {
579 var dragBBox = dragger.getBoundingClientRect();
580 x0 = startX - dragBBox.left;
581 y0 = startY - dragBBox.top;
582
583 gd._fullLayout._calcInverseTransform(gd);
584 var inverse = gd._fullLayout._invTransform;
585 var transformedCoords = Lib.apply3DTransform(inverse)(x0, y0);
586 x0 = transformedCoords[0];
587 y0 = transformedCoords[1];
588
589 mins0 = {
590 a: _this.aaxis.range[0],
591 b: _this.baxis.range[1],
592 c: _this.caxis.range[1]
593 };
594 mins = mins0;
595 span0 = _this.aaxis.range[1] - mins0.a;
596 lum = tinycolor(_this.graphDiv._fullLayout[_this.id].bgcolor).getLuminance();
597 path0 = 'M0,' + _this.h + 'L' + (_this.w / 2) + ', 0L' + _this.w + ',' + _this.h + 'Z';
598 dimmed = false;
599
600 zb = zoomLayer.append('path')
601 .attr('class', 'zoombox')
602 .attr('transform', strTranslate(_this.x0, _this.y0))
603 .style({
604 fill: lum > 0.2 ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0)',
605 'stroke-width': 0
606 })
607 .attr('d', path0);
608
609 corners = zoomLayer.append('path')
610 .attr('class', 'zoombox-corners')
611 .attr('transform', strTranslate(_this.x0, _this.y0))
612 .style({
613 fill: Color.background,
614 stroke: Color.defaultLine,
615 'stroke-width': 1,
616 opacity: 0
617 })
618 .attr('d', 'M0,0Z');
619
620 _this.clearOutline(gd);
621 }
622
623 function getAFrac(x, y) { return 1 - (y / _this.h); }
624 function getBFrac(x, y) { return 1 - ((x + (_this.h - y) / Math.sqrt(3)) / _this.w); }

Callers 1

ternary.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…