Handle global label
This commit is contained in:
17
Architype.js
17
Architype.js
@@ -139,6 +139,10 @@ class Architype {
|
||||
this.drawArrow(step.pos, step.cls);
|
||||
break;
|
||||
|
||||
case 'graphLabel':
|
||||
this.drawGraphLabel(step.min, step.max, step.label);
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
this.drawGroup(step.min, step.max, step.label);
|
||||
break;
|
||||
@@ -180,6 +184,16 @@ class Architype {
|
||||
use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + cls);
|
||||
}
|
||||
|
||||
drawGraphLabel(min, max, label) {
|
||||
let elem = document.createElement('div');
|
||||
this.grid_.appendChild(elem);
|
||||
elem.classList.add('gridGraphLabel');
|
||||
elem.style.gridColumn = (min[0] + 1) + ' / ' + (max[0] + 2);
|
||||
elem.style.gridRow = (min[1] + 1) + ' / ' + (max[1] + 2);
|
||||
elem.innerText = label;
|
||||
this.toSize_.push(elem);
|
||||
}
|
||||
|
||||
drawGroup(min, max, label) {
|
||||
let group = document.createElement('div');
|
||||
this.grid_.appendChild(group);
|
||||
@@ -232,8 +246,9 @@ class Architype {
|
||||
|
||||
fixSizes() {
|
||||
for (let node of this.toSize_) {
|
||||
console.log(node, node.scrollHeight, node.clientHeight);
|
||||
node.style.fontSize = null;
|
||||
for (let size = 20;
|
||||
for (let size = 30;
|
||||
size && (node.scrollWidth > node.clientWidth ||
|
||||
node.scrollHeight > node.clientHeight);
|
||||
--size) {
|
||||
|
||||
Reference in New Issue
Block a user