jinlin
2024-09-26 7ec9326ce00d08f9d957981f2edff6df26f24a28
web/public/SVGOrigin/Method-Draw-master/method-draw/extensions/ext-foreignobject.js
@@ -3,8 +3,8 @@
 *
 * Licensed under the Apache License, Version 2
 *
 * Copyright(c) 2010 Jacques Distler
 * Copyright(c) 2010 Alexis Deveria
 * Copyright(c) 2010 Jacques Distler
 * Copyright(c) 2010 Alexis Deveria
 *
 */
@@ -23,8 +23,8 @@
      svgdoc = S.svgroot.parentNode.ownerDocument,
      started,
      newFO;
    var properlySourceSizeTextArea = function(){
      // TODO: remove magic numbers here and get values from CSS
      var height = $('#svg_source_container').height() - 80;
@@ -35,7 +35,7 @@
      var fc_rules = $('#fc_rules');
      if(!fc_rules.length) {
        fc_rules = $('<style id="fc_rules"><\/style>').appendTo('head');
      }
      }
      fc_rules.text(!on?"":" #tool_topath { display: none !important; }");
      $('#foreignObject_panel').toggle(on);
    }
@@ -44,8 +44,8 @@
      $('#tool_source_save, #tool_source_cancel').toggle(!on);
      $('#foreign_save, #foreign_cancel').toggle(on);
    }
    // Function: setForeignString(xmlString, elt)
    // This function sets the content of element elt to the input XML.
    //
@@ -69,7 +69,7 @@
        console.log(e);
        return false;
      }
      return true;
    };
@@ -86,13 +86,13 @@
      properlySourceSizeTextArea();
      $('#svg_source_textarea').focus();
    }
    function setAttr(attr, val) {
      svgCanvas.changeSelectedAttribute(attr, val);
      S.call("changed", selElems);
    }
    return {
      name: "foreignObject",
      svgicons: "extensions/foreignobject-icons.xml",
@@ -116,7 +116,7 @@
          }
        }
      }],
      context_tools: [{
        type: "input",
        panel: "foreignObject_panel",
@@ -154,8 +154,8 @@
          }
        }
      }
      ],
      callback: function() {
        $('#foreignObject_panel').hide();
@@ -168,12 +168,12 @@
        }
        // TODO: Needs to be done after orig icon loads
        setTimeout(function() {
        setTimeout(function() {
          // Create source save/cancel buttons
          var save = $('#tool_source_save').clone()
            .hide().attr('id', 'foreign_save').unbind()
            .appendTo("#tool_source_back").click(function() {
              if (!editingforeign) return;
              if (!setForeignString($('#svg_source_textarea').val())) {
@@ -184,20 +184,20 @@
              } else {
                endChanges();
              }
              // setSelectMode();
              // setSelectMode();
            });
          var cancel = $('#tool_source_cancel').clone()
            .hide().attr('id', 'foreign_cancel').unbind()
            .appendTo("#tool_source_back").click(function() {
              endChanges();
            });
        }, 3000);
      },
      mouseDown: function(opts) {
        var e = opts.event;
        if(svgCanvas.getMode() == "foreign") {
          started = true;
@@ -245,14 +245,14 @@
          }
        }
      },
      selectedChanged: function(opts) {
        // Use this to update the current selected elements
        selElems = opts.elems;
        var i = selElems.length;
        while(i--) {
          var elem = selElems[i];
          if(elem && elem.tagName == "foreignObject") {
@@ -260,7 +260,7 @@
              $('#foreign_font_size').val(elem.getAttribute("font-size"));
              $('#foreign_width').val(elem.getAttribute("width"));
              $('#foreign_height').val(elem.getAttribute("height"));
              showPanel(true);
            } else {
              showPanel(false);