From b1cee083332f032b7c180c06e89a9f19940a389f Mon Sep 17 00:00:00 2001 From: "huangtong.ht" Date: Sun, 28 Oct 2018 11:11:12 +0800 Subject: [PATCH 1/3] chore: demo index to es5 that ie can run --- demos/assets/index.js | 80 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/demos/assets/index.js b/demos/assets/index.js index 61c58483fe..217ce75717 100644 --- a/demos/assets/index.js +++ b/demos/assets/index.js @@ -1,14 +1,17 @@ (function () { // filtering - const $query = $('#query'); + var $query = $('#query'); + function filter() { - const str = $query.val(); + var str = $query.val(); + if (!str) { $('.demo-thumbnail').show(); } else { $('.demo-thumbnail').each(function () { - const $thumbnail = $(this); - const basename = $thumbnail.data('basename'); + var $thumbnail = $(this); + var basename = $thumbnail.data('basename'); + if (basename.indexOf(str) === -1) { $thumbnail.hide(); } else { @@ -17,28 +20,24 @@ }); } } - $query.on('input', _.debounce(filter)); - // router - let currentId; - const $code = $('#code'); - const htmlEditor = CodeMirror.fromTextArea($code[0], { + $query.on('input', _.debounce(filter)); // router + + var currentId; + var $code = $('#code'); + var htmlEditor = CodeMirror.fromTextArea($code[0], { mode: "text/html", extraKeys: { 'Ctrl-Space': 'autocomplete' }, foldGutter: true, - gutters: [ - 'CodeMirror-linenumbers', - 'CodeMirror-foldgutter' - ], + gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'], lineNumbers: true, lineWrapping: false }); - - const $docContainer = $('#doc-container'); - const $chartPanel = $('#chart-panel'); - const $codePanel = $('#code-panel'); + var $docContainer = $('#doc-container'); + var $chartPanel = $('#chart-panel'); + var $codePanel = $('#code-panel'); function syncCode(code) { $chartPanel.html(''); @@ -47,59 +46,58 @@ } routie({ - '/:id': id => { + '/:id': function id(_id) { $docContainer.show(); - const $htmlCode = $(`#code-${id}`); - const code = $htmlCode.text(); - syncCode(code) + var $htmlCode = $("#code-" + _id); + var code = $htmlCode.text(); + syncCode(code); }, - '': () => { + '': function _(id) { $docContainer.hide(); } - }); + }); // resizable - // resizable $codePanel.resizable({ handleSelector: '#resize-handler', resizeWidthFrom: 'right', resizeHeight: false, - onDragStart() { + onDragStart: function onDragStart() { $docContainer.css('pointer-events', 'none'); $docContainer.css('cursor', 'col-resize'); $codePanel.find('.CodeMirror-gutter-elt').css('cursor', 'col-resize'); }, - onDragEnd() { + onDragEnd: function onDragEnd() { $docContainer.css('pointer-events', 'auto'); $docContainer.css('cursor', 'default'); $codePanel.find('.CodeMirror-gutter-elt').css('cursor', 'default'); - }, - }); + } + }); // copy code - // copy code - const BTN_COPY_SELECTOR = '#copy-code'; - const clipboard = new Clipboard(BTN_COPY_SELECTOR, { - text: () => htmlEditor.getValue(), + var BTN_COPY_SELECTOR = '#copy-code'; + var clipboard = new Clipboard(BTN_COPY_SELECTOR, { + text: function text() { + return htmlEditor.getValue(); + } }); - let timer; - clipboard.on('success', e => { + var timer; + clipboard.on('success', function (e) { e.clearSelection(); $(BTN_COPY_SELECTOR).text('Succeed!'); clearTimeout(timer); - timer = setTimeout(() => { + timer = setTimeout(function () { $(BTN_COPY_SELECTOR).text('Copy'); }, 2000); }); - clipboard.on('error', e => { + clipboard.on('error', function (e) { e.clearSelection(); $(BTN_COPY_SELECTOR).text('Failed!'); clearTimeout(timer); - timer = setTimeout(() => { + timer = setTimeout(function () { $(BTN_COPY_SELECTOR).text('Copy'); }, 2000); - }); + }); // run code - // run code - $('#execute').on('click', () => { + $('#execute').on('click', function () { syncCode(htmlEditor.getValue()); }); -})(); +})(); \ No newline at end of file From f70807d7f77a61bd6adcc8d3fe42fbfc8cc3b5b4 Mon Sep 17 00:00:00 2001 From: "huangtong.ht" Date: Sun, 28 Oct 2018 11:24:23 +0800 Subject: [PATCH 2/3] fix: custom math.sign to compatible with ie browser.Closes #516. --- src/controller/event.js | 2 +- src/util/base.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/controller/event.js b/src/controller/event.js index 783031b5d3..1bdc017b7c 100755 --- a/src/controller/event.js +++ b/src/controller/event.js @@ -53,7 +53,7 @@ class Controller extends Base { _initEventStates() { this._pressing = false; this._dragging = false; - this._currentEventObj = null; + this._currentEventObj = {}; this._dragEventObj = {}; } // register all native dom events diff --git a/src/util/base.js b/src/util/base.js index 1650bfcf89..b9fbaed2ad 100755 --- a/src/util/base.js +++ b/src/util/base.js @@ -5,7 +5,13 @@ */ const MAX_LEVEL = 5; const Util = require('@antv/util/lib'); - +Math.sign = function(x) { + x = +x; + if (x === 0 || isNaN(x)) { + return x; + } + return x > 0 ? 1 : -1; +}; const BaseUtil = { ...Util, lowerFirst: require('lodash/lowerFirst'), From 72472b4a401e6a28e0a6fc17273c81bf245f2f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=80=9A?= Date: Thu, 1 Nov 2018 16:57:29 +0800 Subject: [PATCH 3/3] Release 2.1.4 --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ package.json | 2 +- src/item/node.js | 5 +++-- src/version.js | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 978743d4f9..b43a1e427e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ + +n.n.n / 2018-11-01 +================== + + * Merge pull request #518 from antvis/math.sign + * fix: custom math.sign to compatible with ie browser.Closes #516. + * chore: demo index to es5 that ie can run + * Merge pull request #499 from antvis/fixSVGMinimap + * fix test + * test: reduce the accuracy + * test: reduce the accuracy + * test: reduce the accuracy + * feat: update svg minimap && fix svg dom event + * feat: legend use containerDOM + * fix: high light subgraph z index + * Merge branch 'master' of https://github.com/antvis/g6 + * fix: update edge model should recahe edges + * remove useless file + * Merge pull request #490 from antvis/legend-component + * Merge pull request #494 from spengjie/fixBug454 + * Commit the relevant file only + * Revert "Fix the introduced bug" + * Fix the introduced bug + * Fix bug #454 + * Update README.md + * Update README.md + * fix: delete the dependency of g2 + * feat: _getFilterItems + * fix multi mappers filtering bug + * fix:delete unnecessary notes + * fix: legend component from @antv/component # ChangeLog --- diff --git a/package.json b/package.json index 843cda74e1..1341a7de5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "2.1.4-beta.1", + "version": "2.1.4", "description": "graph visualization frame work", "main": "build/g6.js", "homepage": "https://github.com/antvis/g6", diff --git a/src/item/node.js b/src/item/node.js index 53063fccc6..3cd70e1d36 100755 --- a/src/item/node.js +++ b/src/item/node.js @@ -68,12 +68,13 @@ class Node extends Item { const { centerX, centerY } = bbox; const x1 = x - centerX; const y1 = y - centerY; - const anchor = this.shapeObj.anchor || {}; + const shapeObj = this.shapeObj; + const anchor = shapeObj.anchor || {}; const defaultIntersectBox = this.defaultIntersectBox; let points = []; if (Util.isEmpty(anchorPoints)) { // get link point if there are no default anchors - const intersectBox = anchor.intersectBox || anchor.type || defaultIntersectBox; + const intersectBox = shapeObj.intersectBox || anchor.intersectBox || anchor.type || defaultIntersectBox; switch (intersectBox) { case 'rect': diff --git a/src/version.js b/src/version.js index ec1fbec7c2..ec40e75620 100755 --- a/src/version.js +++ b/src/version.js @@ -1 +1 @@ -module.exports = '2.1.4-beta.1'; +module.exports = '2.1.4';