Skip to content

Commit

Permalink
Temporarily eject VML fillElement while setting properties
Browse files Browse the repository at this point in the history
- Resolves strange issues of properties not being updated (opacity2)
- focusposition no longer needs compensation when the fill element is ejected (causes refill or something)
  • Loading branch information
sebmarkbage committed Apr 14, 2010
1 parent 14761cf commit 878b144
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Source/ART.VML.js
Expand Up @@ -276,6 +276,9 @@ ART.VML.Base = new Class({
_createGradient: function(style, stops){
var fill = this.fillElement;

// Temporarily eject the fill from the DOM
this.element.removeChild(fill);

fill.type = style;
fill.method = 'none';
fill.rotate = true;
Expand All @@ -296,15 +299,15 @@ ART.VML.Base = new Class({
fill.color = color1[0];
fill.color2 = color2[0];

if (fill.colors) fill.colors.value = colors;
else fill.colors = colors;
//if (fill.colors) fill.colors.value = colors; else
fill.colors = colors;

// Opacity order gets flipped when color stops are specified

fill.opacity = color2[1];
fill['ao:opacity2'] = color1[1];

fill.on = true;
this.element.appendChild(fill);
return fill;
},

Expand Down Expand Up @@ -463,11 +466,13 @@ ART.VML.Shape = new Class({
centerX += centerX - focusX;
centerY += centerY - focusY;

focusX = (focusX - centerX) / (radius * 4) + 0.5;
focusY = (focusY - centerY) / (radius * 4) + 0.5;
// Compensation not needed when focusposition is applied out of document
//focusX = (focusX - centerX) / (radius * 4) + 0.5;
//focusY = (focusY - centerY) / (radius * 4) + 0.5;

this.fillElement.focus = '50%';
this.fillElement.focusposition = focusX + ',' + focusY;
//this.fillElement.focusposition = focusX + ',' + focusY;

this._redraw({x: centerX, y: centerY, r: radius * 2});

return this;
Expand Down

0 comments on commit 878b144

Please sign in to comment.