Skip to content

Commit 167ccd0

Browse files
committed
Fix - better object hint generation
When item name too long, cut begin of the item name Otherwise one typically cut object name
1 parent cdc7787 commit 167ccd0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/base/ObjectPainter.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ class ObjectPainter extends BasePainter {
212212
* Such string typically used as object tooltip.
213213
* If result string larger than 20 symbols, it will be cutted. */
214214
getObjectHint() {
215-
const hint = this.getItemName() || this.getObjectName() || this.getClassName() || '';
216-
return (hint.length <= 20) ? hint : hint.slice(0, 17) + '...';
215+
const iname = this.getItemName();
216+
if (iname)
217+
return (iname.length > 20) ? '...' + iname.slice(iname.length - 17) : iname;
218+
return this.getObjectName() || this.getClassName() || '';
217219
}
218220

219221
/** @summary returns color from current list of colors

0 commit comments

Comments
 (0)