From 130ab97dbdf7ffd58701d6704b66bfa569e442c2 Mon Sep 17 00:00:00 2001 From: Yttrium Date: Wed, 19 Jun 2024 11:03:03 +0800 Subject: [PATCH 1/2] feat: refresh jsmind can set to center or not --- src/jsmind.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jsmind.js b/src/jsmind.js index e6095283..50d173cd 100644 --- a/src/jsmind.js +++ b/src/jsmind.js @@ -276,9 +276,8 @@ export default class jsMind { this.layout.reset(); this.data.reset(); } - _show(mind) { + _show(mind, keepCenter) { var m = mind || format.node_array.example; - this.mind = this.data.load(m); if (!this.mind) { logger.error('data.load error'); @@ -293,14 +292,15 @@ export default class jsMind { this.layout.layout(); logger.debug('layout.layout ok'); - this.view.show(true); + this.view.show(keepCenter); logger.debug('view.show ok'); this.invoke_event_handle(EventType.show, { data: [mind] }); } - show(mind) { + show(mind, keepCenter) { + const _keepCenter = keepCenter == null ? true : keepCenter; this._reset(); - this._show(mind); + this._show(mind, _keepCenter); } get_meta() { return { From b947fe05c7c4faea42cebae135803bd23e59bb8a Mon Sep 17 00:00:00 2001 From: Yttrium Date: Wed, 19 Jun 2024 13:42:42 +0800 Subject: [PATCH 2/2] feat: refresh jsmind can set to center or not --- src/jsmind.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/jsmind.js b/src/jsmind.js index 50d173cd..3a67c69c 100644 --- a/src/jsmind.js +++ b/src/jsmind.js @@ -276,7 +276,7 @@ export default class jsMind { this.layout.reset(); this.data.reset(); } - _show(mind, keepCenter) { + _show(mind, skip_centering) { var m = mind || format.node_array.example; this.mind = this.data.load(m); if (!this.mind) { @@ -292,15 +292,14 @@ export default class jsMind { this.layout.layout(); logger.debug('layout.layout ok'); - this.view.show(keepCenter); + this.view.show(!skip_centering); logger.debug('view.show ok'); this.invoke_event_handle(EventType.show, { data: [mind] }); } - show(mind, keepCenter) { - const _keepCenter = keepCenter == null ? true : keepCenter; + show(mind, skip_centering) { this._reset(); - this._show(mind, _keepCenter); + this._show(mind, skip_centering); } get_meta() { return {