@yanqirenshi/d3.deployment 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/Rectum.js CHANGED
@@ -423,6 +423,12 @@ var Rectum = exports["default"] = /*#__PURE__*/function (_Colon) {
423
423
  /**
424
424
  * ノードのクリック通知(callbacks.node.click)。
425
425
  * d3.drag は移動を伴ったクリックを抑止するため、静止クリックだけが届く。
426
+ *
427
+ * コールバックには (core, node) を渡す。
428
+ * core: 入力データそのまま(ライブラリが解釈しないフィールドも落ちない)
429
+ * node: 正規化済みデータ(位置・サイズ等が必要な場合に使う)
430
+ *
431
+ * リンク(a.link-alt)のクリックはリンク側を優先し、コールバックは発火しない。
426
432
  */
427
433
  }, {
428
434
  key: "attachNodeClick",
@@ -430,8 +436,11 @@ var Rectum = exports["default"] = /*#__PURE__*/function (_Colon) {
430
436
  var callback = this._callbacks.node.click;
431
437
  if (!callback) return;
432
438
  place.selectAll('g.node, g.component').on('click', function (event, d) {
439
+ var target = event.target;
440
+ if (target && target.closest && target.closest('a.link-alt')) return; // リンク優先(既存の <a target="_blank"> と干渉しない)
441
+
433
442
  event.stopPropagation();
434
- callback(d);
443
+ callback(d._core, d);
435
444
  });
436
445
  }
437
446
  ///// ////////////////////////////////////////////////////////////////
@@ -95,7 +95,9 @@ var Nodes = exports["default"] = /*#__PURE__*/function () {
95
95
  key: "drawIcon",
96
96
  value: function drawIcon(groups) {
97
97
  var icon_groups = groups.append('g').attr('class', 'icon-group').attr("transform", function (d) {
98
- return "translate(" + (d.size.w - 24 - 20) + "," + 15 + ")";
98
+ // _size は Hierarchy.fitting による調整後サイズ(子要素 + padding で
99
+ // 拡張され得る)。入力の d.size を使うと拡張時に位置がずれる。
100
+ return "translate(" + (d._size.w - 24 - 20) + "," + 15 + ")";
99
101
  });
100
102
  icon_groups.append('rect').attr('class', 'node-body').attr('width', function (d) {
101
103
  return 18;
@@ -155,7 +157,9 @@ var Nodes = exports["default"] = /*#__PURE__*/function () {
155
157
  a_element.append('text').attr('x', function (d) {
156
158
  return 10;
157
159
  }).attr('y', function (d) {
158
- return d.size.h - 10;
160
+ // _size は Hierarchy.fitting による調整後サイズ(子要素 + padding で
161
+ // 拡張され得る)。入力の d.size を使うと拡張時に位置がずれる。
162
+ return d._size.h - 10;
159
163
  }).style("font-size", function (d) {
160
164
  return '12px';
161
165
  }).style("display", function (d) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yanqirenshi/d3.deployment",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "See [Documents](https://yanqirenshi.github.io/D3.Deployment/)",
5
5
  "main": "dist/index.js",
6
6
  "directories": {