[Fixed Position] Allow straight lines

Pad width/height to give enough space to draw straight
lines; fix usage of background for boxes. WTD-880.
This commit is contained in:
Victor Woeltjen 2015-02-20 15:25:27 -08:00
parent 2c0180ebda
commit f9043fdb7d
4 changed files with 11 additions and 11 deletions

View File

@ -1,3 +1,3 @@
<div ng-style="{ background: ngModel.fill }" <div ng-style="{ background: ngModel.element.fill }"
style="width: 100%; height: 100%;"> style="width: 100%; height: 100%;">
</div> </div>

View File

@ -1,9 +1,9 @@
<svg ng-attr-width="{{parameters.gridSize[0] * ngModel.width()}}" <svg ng-attr-width="{{parameters.gridSize[0] * ngModel.width()}}"
ng-attr-height="{{parameters.gridSize[1] * ngModel.height()}}"> ng-attr-height="{{parameters.gridSize[1] * ngModel.height()}}">
<line ng-attr-x1="{{parameters.gridSize[0] * ngModel.x1()}}" <line ng-attr-x1="{{parameters.gridSize[0] * ngModel.x1() + 1}}"
ng-attr-y1="{{parameters.gridSize[1] * ngModel.y1()}}" ng-attr-y1="{{parameters.gridSize[1] * ngModel.y1() + 1}}"
ng-attr-x2="{{parameters.gridSize[0] * ngModel.x2()}}" ng-attr-x2="{{parameters.gridSize[0] * ngModel.x2() + 1}}"
ng-attr-y2="{{parameters.gridSize[1] * ngModel.y2()}}" ng-attr-y2="{{parameters.gridSize[1] * ngModel.y2() + 1}}"
stroke="lightgray" stroke="lightgray"
stroke-width="2"> stroke-width="2">
</line> </line>

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 486 B

View File

@ -12,10 +12,10 @@ define(
border: "transparent" border: "transparent"
}, },
"fixed.line": { "fixed.line": {
x: 0, x: 5,
y: 0, y: 9,
x2: 5, x2: 6,
y2: 3 y2: 6
}, },
"fixed.text": { "fixed.text": {
fill: "transparent", fill: "transparent",

View File

@ -32,11 +32,11 @@ define(
}; };
proxy.width = function () { proxy.width = function () {
return Math.max(element.x, element.x2) - proxy.x(); return Math.max(Math.abs(element.x - element.x2), 1);
}; };
proxy.height = function () { proxy.height = function () {
return Math.max(element.y, element.y2) - proxy.y(); return Math.max(Math.abs(element.y - element.y2), 1);
}; };
proxy.x1 = function () { proxy.x1 = function () {