| 28 |
var borderRadius = parseInt(this.currentStyle['border-radius']); |
var borderRadius = parseInt(this.currentStyle['border-radius']); |
| 29 |
var arcSize = Math.min(1, borderRadius / smallestDimension); |
var arcSize = Math.min(1, borderRadius / smallestDimension); |
| 30 |
|
|
| 31 |
// Workout other details about the shape. |
// Work out other details about the shape. |
| 32 |
var strokeColor = e.css('border-color'); |
var strokeColor = e.css('border-color'); |
| 33 |
var strokeWeight = e.css('border-width'); |
var strokeWeight = e.css('border-width'); |
| 34 |
var fillColor = e.css('background-color'); |
var fillColor = e.css('background-color'); |
| 35 |
var fillSrc = e.css('background-image').replace(/^url\("(.+)"\)$/, '$1'); // @todo: Test this. |
var fillSrc = e.css('background-image').replace(/^url\("(.+)"\)$/, '$1'); // @todo: Test this. |
| 36 |
|
|
| 37 |
|
// Determine the width for inline and block elements. |
| 38 |
|
var oldWidth; |
| 39 |
|
var oldHeight; |
| 40 |
|
if (e.css('display') == 'inline') { |
| 41 |
|
var pad = 2 * (parseInt(strokeWeight)); |
| 42 |
|
oldWidth = (e.width() + pad) + 'px'; |
| 43 |
|
oldHeight = (e.height() + pad) + 'px'; |
| 44 |
|
} |
| 45 |
|
else { |
| 46 |
|
oldWidth = '99.9%'; |
| 47 |
|
oldHeight = '99.9%'; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
// Save elements layout |
// Save elements layout |
| 51 |
var oldStyle = { |
var oldStyle = { |
| 52 |
|
'display': e.css('display'), |
| 53 |
'margin-top': e.css('margin-top'), |
'margin-top': e.css('margin-top'), |
| 54 |
'margin-right': e.css('margin-right'), |
'margin-right': e.css('margin-right'), |
| 55 |
'margin-bottom': e.css('margin-bottom'), |
'margin-bottom': e.css('margin-bottom'), |
| 91 |
|
|
| 92 |
var markup = ''; |
var markup = ''; |
| 93 |
markup += '<div id="' + uniqueId + '" class="ie-border-radius">'; |
markup += '<div id="' + uniqueId + '" class="ie-border-radius">'; |
| 94 |
markup += ' <v:roundrect arcsize="' + arcSize + '" strokecolor="' + strokeColor + '" strokeweight="' + strokeWeight + '" style="behavior: url(#default#VML); display: inline-block; width: 99.9%; height: 99.9%; antialias: true; padding: ' + strokeWeight + 'px;">'; |
markup += ' <v:roundrect arcsize="' + arcSize + '" strokecolor="' + strokeColor + '" strokeweight="' + strokeWeight + '" style="behavior: url(#default#VML); display: inline-block; width: ' + oldWidth + '; height: ' + oldHeight + '; antialias: true; padding: ' + strokeWeight + 'px;">'; |
| 95 |
markup += ' <v:fill color="' + fillColor + '" src="' + fillSrc + '" type="tile" style="behavior: url(#default#VML);" />'; |
markup += ' <v:fill color="' + fillColor + '" src="' + fillSrc + '" type="tile" style="behavior: url(#default#VML);" />'; |
| 96 |
markup += this.outerHTML; |
markup += this.outerHTML; |
| 97 |
markup += ' </v:roundrect>'; |
markup += ' </v:roundrect>'; |
| 99 |
this.outerHTML = markup; |
this.outerHTML = markup; |
| 100 |
|
|
| 101 |
// Apply the old style to the new wrapper. |
// Apply the old style to the new wrapper. |
| 102 |
$('#' + uniqueId).css(oldStyle); |
$('#' + uniqueId).css(oldStyle); |
| 103 |
} |
} |
| 104 |
} |
} |
| 105 |
|
|