StetHD / cakejs

Automatically exported from code.google.com/p/cakejs
0 stars 0 forks source link

Fixed bounding box merging in CanvasNode #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
the function CanvasNode::mergeBoundingBoxes was not preserving the upper bounds 
of the original box. This fix seems to do it:

mergeBoundingBoxes : function(bb, bb2) {
    var obx = bb[0], oby = bb[1]
    //change lower corner
    if (bb[0] > bb2[0]) bb[0] = bb2[0]
    if (bb[1] > bb2[1]) bb[1] = bb2[1]
    //match original upper corner
    bb[2] = bb[2] + obx - bb[0]
    bb[3] = bb[3] + oby - bb[1]
    //compare upper corners
    if (bb[2]+bb[0] < bb2[2]+bb2[0]) bb[2] = bb2[2]+bb2[0]-bb[0]
    if (bb[3]+bb[1] < bb2[3]+bb2[1]) bb[3] = bb2[3]+bb2[1]-bb[1]
  },

Original issue reported on code.google.com by crgod...@gmail.com on 24 Jul 2011 at 4:24

GoogleCodeExporter commented 8 years ago
Issue has been fixed with rev76

Original comment by crgod...@gmail.com on 25 Jul 2011 at 5:00

GoogleCodeExporter commented 8 years ago
changing owner...

Original comment by crgod...@gmail.com on 25 Jul 2011 at 5:02