Skip to content

Commit 820bc48

Browse files
committed
Fix - do not hide canvas drawn for JSON from TWebCanvas
1 parent 0db8a77 commit 820bc48

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

modules/gpad/RPadPainter.mjs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,19 @@ class RPadPainter extends RObjectPainter {
436436
this.createAttFill({ pattern: 1001, color: 0 });
437437

438438
if ((rect.width <= lmt) || (rect.height <= lmt)) {
439-
svg.style('display', 'none');
440-
console.warn(`Hide canvas while geometry too small w=${rect.width} h=${rect.height}`);
441-
rect.width = 200; rect.height = 100; // just to complete drawing
439+
if (this.snapid === undefined) {
440+
svg.style('display', 'none');
441+
console.warn(`Hide canvas while geometry too small w=${rect.width} h=${rect.height}`);
442+
}
443+
if (this._pad_width && this._pad_height) {
444+
// use last valid dimensions
445+
rect.width = this._pad_width;
446+
rect.height = this._pad_height;
447+
} else {
448+
// just to complete drawing.
449+
rect.width = 800;
450+
rect.height = 600;
451+
}
442452
} else
443453
svg.style('display', null);
444454

modules/gpad/TPadPainter.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,10 @@ class TPadPainter extends ObjectPainter {
682682
this.createAttFill({ attr: this.pad });
683683

684684
if ((rect.width <= lmt) || (rect.height <= lmt)) {
685-
svg.style('display', 'none');
686-
console.warn(`Hide canvas while geometry too small w=${rect.width} h=${rect.height}`);
685+
if (this.snapid === undefined) {
686+
svg.style('display', 'none');
687+
console.warn(`Hide canvas while geometry too small w=${rect.width} h=${rect.height}`);
688+
}
687689
if (this._pad_width && this._pad_height) {
688690
// use last valid dimensions
689691
rect.width = this._pad_width;

0 commit comments

Comments
 (0)