Bug 1430918 - Draw grid outline from origin. r=gl draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Sun, 11 Feb 2018 18:52:02 -0600
changeset 753977 ee4a6bae902d1ed7101e09876c7947e63d7d2cac
parent 753976 165474ef313b106f0364cf1941a0030c41855876
child 753978 cc4fe98a1086ad123e7e02f98f010f719818fc10
push id98727
push userbmo:jryans@gmail.com
push dateMon, 12 Feb 2018 18:15:41 +0000
reviewersgl
bugs1430918
milestone60.0a1
Bug 1430918 - Draw grid outline from origin. r=gl The transforms that can be applied to the grid outline to adjust for writing mode may include translation and reflection based on the outline's width or height. To achieve the expected result, we need to start drawing the outline at (0, 0) instead of (1, 1). MozReview-Commit-ID: HjbREuyNpvH
devtools/client/inspector/grids/components/GridOutline.js
--- a/devtools/client/inspector/grids/components/GridOutline.js
+++ b/devtools/client/inspector/grids/components/GridOutline.js
@@ -214,18 +214,18 @@ class GridOutline extends PureComponent 
     // In the future we will need to iterate over all fragments of a grid.
     let gridFragmentIndex = 0;
     const { id, color, gridFragments } = grid;
     const { rows, cols, areas } = gridFragments[gridFragmentIndex];
 
     const numberOfColumns = cols.lines.length - 1;
     const numberOfRows = rows.lines.length - 1;
     const rectangles = [];
-    let x = 1;
-    let y = 1;
+    let x = 0;
+    let y = 0;
     let width = 0;
     let height = 0;
 
     // Draw the cells contained within the grid outline border.
     for (let rowNumber = 1; rowNumber <= numberOfRows; rowNumber++) {
       height = GRID_CELL_SCALE_FACTOR * (rows.tracks[rowNumber - 1].breadth / 100);
 
       for (let columnNumber = 1; columnNumber <= numberOfColumns; columnNumber++) {
@@ -235,17 +235,17 @@ class GridOutline extends PureComponent 
         const gridCell = this.renderGridCell(id, gridFragmentIndex, x, y,
                                              rowNumber, columnNumber, color, gridAreaName,
                                              width, height);
 
         rectangles.push(gridCell);
         x += width;
       }
 
-      x = 1;
+      x = 0;
       y += height;
     }
 
     // Draw a rectangle that acts as the grid outline border.
     const border = this.renderGridOutlineBorder(this.state.width, this.state.height,
                                                 color);
     rectangles.unshift(border);
 
@@ -310,18 +310,18 @@ class GridOutline extends PureComponent 
     );
   }
 
   renderGridOutlineBorder(borderWidth, borderHeight, color) {
     return dom.rect(
       {
         key: "border",
         className: "grid-outline-border",
-        x: 1,
-        y: 1,
+        x: 0,
+        y: 0,
         width: borderWidth,
         height: borderHeight
       }
     );
   }
 
   renderOutline() {
     const {