jinlin
2024-09-26 7ec9326ce00d08f9d957981f2edff6df26f24a28
web/public/SVGOrigin/Method-Draw-master/editor/src/select.js
@@ -27,7 +27,7 @@
// Class: svgedit.select.Selector
// Private class for DOM element selection boxes
//
//
// Parameters:
// id - integer to internally indentify the selector
// elem - DOM element associated with this selector
@@ -61,7 +61,7 @@
      }
    })
  );
  if (svgedit.browser.isTouch()) {
    this.selectorRect.setAttribute("stroke-opacity", 0.3);
  }
@@ -82,10 +82,10 @@
};
// Function: svgedit.select.Selector.reset
// Function: svgedit.select.Selector.reset
// Used to reset the id and element that the selector is attached to
//
// Parameters:
// Parameters:
// e - DOM element associated with this selector
svgedit.select.Selector.prototype.reset = function(e) {
  this.locked = true;
@@ -164,7 +164,7 @@
  var bbox = svgedit.utilities.getBBox(selected);
  if(tagName === 'g' && !$.data(selected, 'gsvg')) {
    // The bbox for a group does not include stroke vals, so we
    // get the bbox based on its children.
    // get the bbox based on its children.
    var stroked_bbox = svgFactory_.getStrokedBBox(selected.childNodes);
    if(stroked_bbox) {
      bbox = stroked_bbox;
@@ -177,17 +177,17 @@
  // we need to handle temporary transforms too
  // if skewed, get its transformed box, then find its axis-aligned bbox
  //*
  offset *= current_zoom;
  var nbox = svgedit.math.transformBox(l*current_zoom, t*current_zoom, w*current_zoom, h*current_zoom, m),
    aabox = nbox.aabox,
    nbax = aabox.x - offset,
    nbay = aabox.y - offset,
    nbaw = aabox.width + (offset * 2),
    nbah = aabox.height + (offset * 2);
  // now if the shape is rotated, un-rotate it
  var cx = nbax + nbaw/2,
    cy = nbay + nbah/2;
@@ -227,7 +227,7 @@
        + ' ' + (nbax+nbaw) + ',' + (nbay+nbah)
        + ' ' + nbax + ',' + (nbay+nbah) + 'z';
  selectedBox.setAttribute('d', dstr);
  var xform = angle ? 'rotate(' + [angle,cx,cy].join(',') + ')' : '';
  this.selectorGroup.setAttribute('transform', xform);
@@ -255,17 +255,17 @@
      selectedGrips[dir].setAttribute('x', coords[0]);
      selectedGrips[dir].setAttribute('y', coords[1]);
    };
    this.rotateCoords = {
      'nw': [nbax, nbay],
      'ne': [nbax+nbaw+8, nbay],
      'sw': [nbax, nbay+nbah+8],
      'se': [nbax+nbaw+8, nbay+nbah+8]
    };
    for(var dir in this.rotateCoords) {
      var coords = this.rotateCoords[dir];
      mgr.rotateGrips[dir].setAttribute('cx', coords[0]);
      mgr.rotateGrips[dir].setAttribute('cx', coords[0]);
      mgr.rotateGrips[dir].setAttribute('cy', coords[1]);
    }
@@ -369,12 +369,12 @@
      }
    });
    if (svgedit.browser.isTouch()) {
      grip.setAttribute("width", 30.5)
      grip.setAttribute("height", 30.5)
      grip.setAttribute("fill-opacity", 0.3)
    }
    $.data(grip, 'dir', dir);
    $.data(grip, 'type', 'resize');
    this.selectorGrips[dir] = this.selectorGripsGroup.appendChild(grip);
@@ -402,7 +402,7 @@
      'id': 'placeholder_defs'
    }
  })
  var pattern = svgFactory_.createSVGElement({
    'element': 'pattern',
    'attr': {
@@ -415,7 +415,7 @@
      'viewBox': '0 0 10 10'
    }
  })
  var pattern_bg = svgFactory_.createSVGElement({
    'element': 'rect',
    'attr': {
@@ -437,7 +437,7 @@
      'fill': "#eee"
    }
  })
  var pattern_square2 = svgFactory_.createSVGElement({
    'element': 'rect',
    'attr': {
@@ -505,7 +505,7 @@
};
// Function: svgedit.select.SelectorManager.releaseSelector
// Removes the selector of the given element (hides selection box)
// Removes the selector of the given element (hides selection box)
//
// Parameters:
// elem - DOM element to remove the selector for
@@ -546,7 +546,7 @@
          'fill': 'none',
          'stroke': '#666',
          'stroke-width': 1,
          'stroke-dasharray': '3,2',
          'stroke-dasharray': '3,2',
          'display': 'none',
          'style': 'pointer-events:none'
        }
@@ -602,4 +602,4 @@
  return selectorManager_;
};
})();
})();