diff options
| author | mrmr1993 | 2014-12-17 12:31:09 +0000 | 
|---|---|---|
| committer | mrmr1993 | 2014-12-17 12:31:09 +0000 | 
| commit | 62686e83d690919f00afe1ac7f5955cecb1d2b2f (patch) | |
| tree | a1bb07c63f8ada78762bfd9e6e5448c49361e8c8 /lib/dom_utils.coffee | |
| parent | 5f9290693ab0f35c46cea6cea0a9f5c06b4ee0ad (diff) | |
| download | vimium-62686e83d690919f00afe1ac7f5955cecb1d2b2f.tar.bz2 | |
Try to make image map rectangles work better
Diffstat (limited to 'lib/dom_utils.coffee')
| -rw-r--r-- | lib/dom_utils.coffee | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 3d7e805f..842dda0f 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -95,17 +95,18 @@ DomUtils =      for area in areas        coords = area.coords.split(",").map((coord) -> parseInt(coord, 10))        shape = area.shape.toLowerCase() -      if shape == "rect" +      if shape == "rect" or coords.length == 4          [x1, y1, x2, y2] = coords -      else if shape == "circle" +      else if shape == "circle" or coords.length == 3          [x, y, r] = coords          x1 = x - r          x2 = x + r          y1 = y - r          y2 = y + r -      else # For polygons and unknown shapes, don't return a rectangle. -        # TODO(mrmr1993): revisit this. -        continue +      else +        # Just consider the rectangle surrounding the first two points in a polygon. It's possible to do +        # something more sophisticated, but likely not worth the effort. +        [x1, y1, x2, y2] = coords        rect =          top: imgClientRect.top + y1  | 
