Skip to content

Commit

Permalink
fix(dia.ElementView): prevent exception when position or size is not …
Browse files Browse the repository at this point in the history
…defined
  • Loading branch information
kumilingus committed Jul 22, 2024
1 parent b1b7a45 commit 1c705c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/joint-core/src/dia/ElementView.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ export const ElementView = CellView.extend({

getTranslateString: function() {

var position = this.model.attributes.position;
return 'translate(' + position.x + ',' + position.y + ')';
const { x, y } = this.model.position();
return `translate(${x},${y})`;
},

getRotateString: function() {
var attributes = this.model.attributes;
var angle = attributes.angle;

const angle = this.model.angle();
if (!angle) return null;
var size = attributes.size;
return 'rotate(' + angle + ',' + (size.width / 2) + ',' + (size.height / 2) + ')';
const { width, height } = this.model.size();
return `rotate(${angle},${width / 2},${height / 2})`;
},

// Rotatable & Scalable Group
Expand Down

0 comments on commit 1c705c1

Please sign in to comment.