Search code examples
jointjs

Get the width/height of paper using JointJS


I resize the paper size by moving model :

paper.on('cell:pointermove', 
function(cellView, evt, x, y) { 
    if((x+cellView.model.prop('size/width'))>=650 &&(y+cellView.model.prop('size/height'))>=200)
    paper.setDimensions(x+cellView.model.prop('size/width'), y+cellView.model.prop('size/height'));
}

Is there any way I can change the property of paper just like element.prop(properties)?


Solution

  • You can get the width/height of the paper with paper.options.width and paper.options.height. Paper is a view, not a model so it does not have set()/get()/prop()/attr() methods but you can always store properties to it just like to any other object if you want: paper.foo = 'bar'