Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在jointjs图中一次调整所有单元格(rect)的大小_Javascript_Jointjs - Fatal编程技术网

Javascript 在jointjs图中一次调整所有单元格(rect)的大小

Javascript 在jointjs图中一次调整所有单元格(rect)的大小,javascript,jointjs,Javascript,Jointjs,加载jointjs图后,我想调整所有单元格(rect)的大小,使它们与文本较大的单元格具有相同的高度 我一次调整了所有元素的大小,如下所示: _.each(paper.model.getElements(), function(el) { el.set({ size: { width: 170 , height: newHeight} }) }) joint.shapes.basic.CustomShape = joint.shapes.basic.Generic.

加载jointjs图后,我想调整所有单元格(rect)的大小,使它们与文本较大的单元格具有相同的高度

我一次调整了所有元素的大小,如下所示:

_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
在我的元素中,有像“Rect”这样的元素和我用“path”创建的一些形状。 设置新大小时,使用“路径”创建的元素不仅可以调整大小,还可以更改它们在Y轴上的位置

知道为什么我的“路径”元素会重新定位吗

我的“路径”形状如下所示:

_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
joint.shapes.basic.CustomShape=joint.shapes.basic.Generic.extend({
标记:“”,
默认值:joint.util.deepaddress({
键入:“my.CustomShape”,
属性:{
路径:{d:'M020L175008010010020Z',填充:'#ffffd9',笔划:'#4dd4d',宽度:100,高度:60',笔划宽度:'0.03em'},
文本:{ref:'path','line height':24},
“.word1”:{‘字体大小’:12,填充:‘#58ab00’,‘字体大小’:‘粗体’,‘字体系列’:‘Arial,helvetica,sans serif’,‘x’:‘4em’,‘y’:‘5em’,
“.word2”:{‘字体大小’:11,填充:‘#000000’,‘字体系列’:‘Arial,helvetica,sans serif’,‘x’:‘37’,‘y’:‘7.5em’}
}      
},joint.shapes.basic.Generic.prototype.defaults)
});

我一次调整了所有元素的大小,如下所示:

_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
在我的元素中,有像“Rect”这样的元素和我用“path”创建的一些形状。 设置新大小时,使用“路径”创建的元素不仅可以调整大小,还可以更改它们在Y轴上的位置

知道为什么我的“路径”元素会重新定位吗

我的“路径”形状如下所示:

_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
_.each(paper.model.getElements(), function(el) {
    el.set({ size: { width: 170 , height: newHeight} })         
 })
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)
});
joint.shapes.basic.CustomShape=joint.shapes.basic.Generic.extend({
标记:“”,
默认值:joint.util.deepaddress({
键入:“my.CustomShape”,
属性:{
路径:{d:'M020L175008010010020Z',填充:'#ffffd9',笔划:'#4dd4d',宽度:100,高度:60',笔划宽度:'0.03em'},
文本:{ref:'path','line height':24},
“.word1”:{‘字体大小’:12,填充:‘#58ab00’,‘字体大小’:‘粗体’,‘字体系列’:‘Arial,helvetica,sans serif’,‘x’:‘4em’,‘y’:‘5em’,
“.word2”:{‘字体大小’:11,填充:‘#000000’,‘字体系列’:‘Arial,helvetica,sans serif’,‘x’:‘37’,‘y’:‘7.5em’}
}      
},joint.shapes.basic.Generic.prototype.defaults)
});
谢谢大家!