Resize all cells (rect) at once in jointjs diagram -


after jointjs diagram loaded want resize cells (rect) have same height 1 bigger text.

i managed resize elements @ once, this:

_.each(paper.model.getelements(), function(el) {     el.set({ size: { width: 170 , height: newheight} })           }) 

among elements, there elements "rect" , shapes created "path". when set new size, elements created "path" not resize, changes position on y axis.

any idea why "path" elements reposition?

my "path" shape looks this:

joint.shapes.basic.customshape = joint.shapes.basic.generic.extend({  markup: '<g class="rotatable"><g class="scalable"><path/></g><text><tspan class="word1"></tspan> <tspan class="word2"></tspan></text></g>',  defaults: joint.util.deepsupplement({      type: 'my.customshape',     attrs: {         path : {d: 'm 0 20 l 17 50 0 80 100 80  100 20  z',  fill: '#ffffd9', stroke: '#4d4d4d', width: 100, height: 60,  'stroke-width':'0.03em'},         text: { ref: 'path' , 'line-height': 24 },         '.word1': { 'font-size': 12, fill: '#58ab00', 'font-weight': 'bold', 'font-family': 'arial, helvetica, sans-serif', 'x':'4em' , 'y' : '5em'},         '.word2': { 'font-size': 11, fill: '#000000', 'font-family': 'arial, helvetica, sans-serif', 'x':'37', 'y' : '7.5em'}     }       }, joint.shapes.basic.generic.prototype.defaults) }); 

i managed resize elements @ once, this:

_.each(paper.model.getelements(), function(el) {     el.set({ size: { width: 170 , height: newheight} })           }) 

among elements, there elements "rect" , shapes created "path". when set new size, elements created "path" not resize, changes position on y axis.

any idea why "path" elements reposition?

my "path" shape looks this:

joint.shapes.basic.customshape = joint.shapes.basic.generic.extend({   markup: '<g class="rotatable"><g class="scalable"><path/></g><text><tspan class="word1"></tspan> <tspan class="word2"></tspan></text></g>',  defaults: joint.util.deepsupplement({      type: 'my.customshape',     attrs: {         path : {d: 'm 0 20 l 17 50 0 80 100 80  100 20  z',  fill: '#ffffd9', stroke: '#4d4d4d', width: 100, height: 60,  'stroke-width':'0.03em'},         text: { ref: 'path' , 'line-height': 24 },         '.word1': { 'font-size': 12, fill: '#58ab00', 'font-weight': 'bold', 'font-family': 'arial, helvetica, sans-serif', 'x':'4em' , 'y' : '5em'},         '.word2': { 'font-size': 11, fill: '#000000', 'font-family': 'arial, helvetica, sans-serif', 'x':'37', 'y' : '7.5em'}     }       }, joint.shapes.basic.generic.prototype.defaults) }); 

thank you!


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -