Skip to content

Commit

Permalink
Fix js errors in chrome 35
Browse files Browse the repository at this point in the history
Was getting

```
Error: Invalid value for <text> attribute transform=" "
```

This has been fixed in jointjs HEAD but not released yet. This includes
a hand-built release of joint js from the repo revision 26b62f37b7.
  • Loading branch information
heathd committed May 27, 2014
1 parent fdf4285 commit 1545626
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions vendor/assets/javascripts/joint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v0.9.0 - JavaScript diagramming library 2014-05-13
/*! JointJS v0.9.0 - JavaScript diagramming library 2014-05-27


This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -16990,11 +16990,12 @@ if ( typeof window === "object" && typeof window.document === "object" ) {
transformAttr = transformAttr.replace(/translate\([^\)]*\)/g, '').trim();

var newTx = transform.translate.tx + tx,
newTy = transform.translate.ty + ty;
newTy = transform.translate.ty + ty,
newTranslate = 'translate(' + newTx + ',' + newTy + ')';

// Note that `translate()` is always the first transformation. This is
// usually the desired case.
this.attr('transform', 'translate(' + newTx + ',' + newTy + ') ' + transformAttr);
this.attr('transform', (newTranslate + ' ' + transformAttr).trim());
return this;
},

Expand All @@ -17010,9 +17011,10 @@ if ( typeof window === "object" && typeof window.document === "object" ) {
transformAttr = transformAttr.replace(/rotate\([^\)]*\)/g, '').trim();

var newAngle = transform.rotate.angle + angle % 360,
newOrigin = (cx !== undefined && cy !== undefined) ? ',' + cx + ',' + cy : '';
newOrigin = (cx !== undefined && cy !== undefined) ? ',' + cx + ',' + cy : '',
newRotate = 'rotate(' + newAngle + newOrigin + ')';

this.attr('transform', transformAttr + ' rotate(' + newAngle + newOrigin + ')');
this.attr('transform', (transformAttr + ' ' + newRotate).trim());
return this;
},

Expand All @@ -17030,7 +17032,9 @@ if ( typeof window === "object" && typeof window.document === "object" ) {

transformAttr = transformAttr.replace(/scale\([^\)]*\)/g, '').trim();

this.attr('transform', transformAttr + ' scale(' + sx + ',' + sy + ')');
var newScale = 'scale(' + sx + ',' + sy + ')';

this.attr('transform', (transformAttr + ' ' + newScale).trim());
return this;
},

Expand Down Expand Up @@ -20346,7 +20350,7 @@ joint.dia.ElementView = joint.dia.CellView.extend({
// relative to the root bounding box following the `ref-x` and `ref-y` attributes.
if (vel.attr('transform')) {

vel.attr('transform', vel.attr('transform').replace(/translate\([^)]*\)/g, '') || '');
vel.attr('transform', vel.attr('transform').replace(/translate\([^)]*\)/g, '').trim() || '');
}

function isDefined(x) {
Expand Down

0 comments on commit 1545626

Please sign in to comment.