當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript d3.mouse函數代碼示例

本文整理匯總了TypeScript中d3.mouse函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mouse函數的具體用法?TypeScript mouse怎麽用?TypeScript mouse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mouse函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: reset

  reset() {
    const svgNode = this.scope.svg.node();
    const mx = d3.mouse(svgNode)[0];
    const my = d3.mouse(svgNode)[1];

    const t = d3.zoomIdentity.translate(0, 0).scale(1);
    this.scope.svg.call(this.scope.plotZoom.zoomObj.transform, t);

    const lMargin = this.scope.layout.leftLayoutMargin;
    const bMargin = this.scope.layout.bottomLayoutMargin;
    const H = plotUtils.safeHeight(this.scope.jqsvg);

    if (mx < lMargin && my < H - bMargin) {
      _.extend(this.focus, _.pick(this.defaultFocus, "yl", "yr", "yspan", "yl_r", "yr_r", "yspan_r"));
    } else if (my > H - bMargin && mx > lMargin) {
      _.extend(this.focus, _.pick(this.defaultFocus, "xl", "xr", "xspan"));
    } else {
      _.extend(this.focus, this.defaultFocus);
    }

    this.fix(this.focus);
    this.scope.plotRange.calcMapping(true);
    this.scope.emitZoomLevelChange();
    this.scope.update();
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:25,代碼來源:PlotFocus.ts

示例2: zoomBoxZooming

  zoomBoxZooming(): void {
    const svgNode = this.scope.svg.node();

    // right click zoom
    this.scope.mousep2 = {
      x: d3.mouse(svgNode)[0],
      y: d3.mouse(svgNode)[1]
    };
    this.locateBox = this.getLocateBoxCoords();
    this.scope.rpipeRects = [];
    this.renderLocateBox();
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:12,代碼來源:BoxZoom.ts

示例3: function

 .on('start', function () {
   resizer.resizerRight.classed("dragged", true);
   const x = d3.mouse(this.parentElement)[0];
   if (x < (resizer.clientWidth - deadWidth)) {
     resizer.sepRightSnap = resizer.sepRight;
   }
 })
開發者ID:dnalborczyk,項目名稱:node,代碼行數:7,代碼來源:resizer.ts

示例4: function

 .on('start', function () {
   resizer.resizer_right.classed("dragged", true);
   let x = d3.mouse(this.parentElement)[0];
   if (x < (resizer.client_width - dead_width)) {
     resizer.sep_right_snap = resizer.sep_right;
   }
 })
開發者ID:darahayes,項目名稱:node,代碼行數:7,代碼來源:turbo-visualizer.ts

示例5: toggleTooltip

  export function toggleTooltip(scope, d) {
    if (!d || scope.zoomed === true) {
      return;
    } // prevent dragging and toggling at the same time

    const id = d.id;
    
    if (!scope.tips[id]) {
      tooltip(scope, d, d3.mouse(scope.svg[0][0]));
    } else {
      scope.tips[id].sticking = !scope.tips[id].sticking;
      
      if (scope.tips[id].sticking === false) {
        hideTips(scope, d.id);
        untooltip(scope, d);
      }
    }
    
    renderTips(scope);
  }
開發者ID:twosigma,項目名稱:beaker-notebook,代碼行數:20,代碼來源:plotTip.ts

示例6: function

svg.on("click", function(a, b, c) {
    const coords = d3.mouse(svg.node());
    balls.push(randomBall(coords[0], coords[1]));
});
開發者ID:eddking,項目名稱:typescript-fun,代碼行數:4,代碼來源:app.ts


注:本文中的d3.mouse函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。