Permalink
Browse files

Fix handling of negative coordinates.

Also some display tweaks.
  • Loading branch information...
1 parent 7cadcf1 commit 72ebeb2c90139bc47ad6226b39e473435a198ebf @bemjb bemjb committed Aug 27, 2012
Showing with 6 additions and 6 deletions.
  1. +1 −1 CSSExclusionShapeViewer.html
  2. +1 −1 CSSExclusionShapeViewer.js
  3. +4 −4 main.js
View
2 CSSExclusionShapeViewer.html
@@ -1,3 +1,3 @@
-<div style="width:100%; padding-top: 5%;">
+<div style="width:100%; padding-top: 5%">
<svg id="shape" style="margin-left:auto; margin-right:auto; display:block;" xmlns="http://www.w3.org/2000/svg" version="1.1"></svg>
</div>
View
2 CSSExclusionShapeViewer.js
@@ -72,7 +72,7 @@ define(function (require, exports, module) {
};
CSSExclusionShapeViewer.prototype._sizeEditorToContent = function () {
- this.hostEditor.setInlineWidgetHeight(this, this.$wrapperDiv.height() + 20, true);
+ this.hostEditor.setInlineWidgetHeight(this, this.$wrapperDiv.height() + this.height * 0.2 + 20, true);
};
module.exports = CSSExclusionShapeViewer;
View
8 main.js
@@ -220,11 +220,11 @@ define(function (require, exports, module) {
}
});
// scale points so that they fit the viewport and format for svg
- scale = 200 / (maxX < maxY ? maxY : maxX);
- translate = (minX > minY ? minY : minX) * scale;
+ translate = (minX > minY ? minY : minX);
+ scale = 200 / ((maxX < maxY ? maxY : maxX) - translate);
points = $.map(points, function (point, index) {
- var x = point.x * scale - translate;
- var y = point.y * scale - translate;
+ var x = (point.x - translate) * scale;
+ var y = (point.y - translate) * scale;
return x + "," + y;
});
if (foundBadPoint) {

0 comments on commit 72ebeb2

Please sign in to comment.