示例#1
0
 /**
  * Creates controls for moving and rotating the object
  *
  * @return string
  */
 protected function _getControls()
 {
     function drawArrow($x, $y, $id, $rot, $funct)
     {
         $arrow_points = $x + 12 . ',' . ($y + 3) . ' ' . ($x + 3) . ',' . ($y + 8) . ' ' . ($x + 12) . ',' . ($y + 13);
         $arrow = "\t<g id=\"" . $id . '" transform="rotate(' . $rot . ', ' . ($x + 8) . ', ' . ($y + 8) . ')" onclick="' . $funct . "\" style=\"cursor:pointer\">\n";
         $arrow .= "\t\t<rect x=\"" . $x . '" y="' . $y . '" width="16" height="16" ' . " style=\"fill:#bbb; stroke:none;\" />\n";
         $arrow .= "\t\t<rect x=\"" . ($x + 1) . '" y="' . ($y + 1) . '" width="14" height="14" ' . " style=\"fill:#ddd; stroke:none;\" />\n";
         $arrow .= "\t\t<polygon points=\"" . $arrow_points . '" ' . " style=\"fill:#000; stroke:none;\" />\n";
         $arrow .= "\t</g>\n";
         return $arrow;
     }
     $x = $this->_x * 0.05;
     $y = $this->_y * 0.05;
     $controls = "\n\t<!-- Control Elements -->\n";
     $controls .= "\t<rect x=\"0\" y=\"0\" width=\"" . $this->_x . "\" height=\"20\" style=\"fill:#eee; stroke:#ddd; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     // Button "1:1"
     $controls .= "\t<g onclick=\"move_to_default()\" style=\"cursor:pointer;\">\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     $controls .= "\t\t<text x=\"10\" y=\"14\" style=\"font-size:10px; text-anchor:middle;\">1:1</text>\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
     $controls .= "\t</g>\n";
     // Button "zoom in"
     $controls .= "\t<g onclick=\"zoom_in(10)\" transform=\"translate(25, 0)\" style=\"cursor:pointer;\">\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     $controls .= "\t\t<path style=\"fill:#999; stroke:#aaa; stroke-width:1px;\" d=\"M 5 13 L 3 17 A 2 2 0 0 0 8 17 L 11 14\"/>\n";
     $controls .= "\t\t<circle cx=\"11\" cy=\"9\" r=\"7\" style=\"fill:#fff; stroke:#ccc; stroke-width:1px;\" />\n";
     $controls .= "\t\t<text x=\"11\" y=\"13\" style=\"font-size:10px; text-anchor:middle;\">+</text>\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
     $controls .= "\t</g>\n";
     // Button "zoom out"
     $controls .= "\t<g onclick=\"zoom_out(10)\" transform=\"translate(46, 0)\" style=\"cursor:pointer;\">\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     $controls .= "\t\t<path style=\"fill:#999; stroke:#aaa; stroke-width:1px;\" d=\"M 5 13 L 3 17 A 2 2 0 0 0 8 17 L 11 14\"/>\n";
     $controls .= "\t\t<circle cx=\"11\" cy=\"9\" r=\"7\" style=\"fill:#fff; stroke:#ccc; stroke-width:1px;\" />\n";
     $controls .= "\t\t<text x=\"10\" y=\"8\" style=\"font-size:10px; text-anchor:middle;\">_</text>\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
     $controls .= "\t</g>\n";
     /*// Button "hand"
             $controls .= "\t<g transform=\"translate(70, 0)\">\n";
             $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
             $controls .= "\t\t<path d=\"M 7.95,18.08 C 8.01,15.70 5.14,15.75 4.62,12.86 C 4.09,9.934 3.76,8.16 3.76,8.16 C 3.76,8.16 5.54,7.95 5.98,9.47 C 6.42,11 7.07,12.48 7.07,12.48 C 7.07,12.48 6.12,5.12 6.16,4.68 C 6.22,4.04 6.30,3.28 6.953,3.24 C 7.64,3.19 8.06,3.66 8.26,4.51 C 8.38,5.05 8.98,8.49 8.98,8.49 C 8.98,8.49 8.66,3.41 8.84,2.98 C 9.131,2.30 9.17,1.97 9.81,1.92 C 10.45,1.88 10.94,2.60 11.05,3.07 C 11.15,3.53 11.37,8.24 11.37,8.24 C 11.37,8.24 11.55,4.08 11.81,3.49 C 12.08,2.90 12.14,2.39 12.78,2.47 C 13.42,2.56 13.80,3.19 13.74,3.87 C 13.69,4.55 13.74,9.72 13.74,9.72 C 13.74,9.72 14.30,7.12 14.45,6.63 C 14.63,6.03 15.17,5.32 15.70,5.48 C 16.13,5.61 16.27,7.01 15.95,8.52 C 15.65,9.92 15.32,11.86 15.06,12.77 C 14.79,13.68 14.36,14.38 13.77,15.17 C 13.18,15.96 12.94,17.01 12.97,18.11 C 10.73,18.16 8.71,18.07 7.95,18.07\" style=\"fill:#fff; stroke:#000; stroke-width:.5;\" />\n";
             $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
             $controls .= "\t</g>\n";
     
             // Button "drag"
             $controls .= "\t<g transform=\"translate(91, 0)\">\n";
             $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
             $controls .= "\t\t<text x=\"10\" y=\"14\" style=\"font-size:10px; text-anchor:middle;\">d</text>\n";
             $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
             $controls .= "\t</g>\n";*/
     // Button "rotate counter-clockwise"
     $controls .= "\t<g transform=\"translate(115, 0)\" onclick=\"rotate_z_ccw(15)\" style=\"cursor:pointer;\">\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     $controls .= "\t\t<path style=\"fill:none; stroke:#000; stroke-width:1px;\" d=\"M 9 16 A 6 6 0 1 0 5 10\" />\n";
     $controls .= "\t\t<polygon style=\"fill:#000;\" points=\"2,10 8,10 5,14\" />\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
     $controls .= "\t</g>\n";
     // Button "rotate clockwise"
     $controls .= "\t<g transform=\"translate(136, 0)\" onclick=\"rotate_z_cw(15)\" style=\"cursor:pointer;\">\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"fill:url(#b_off); stroke:#ccc; stroke-width:1px; shape-rendering:optimizeSpeed;\" />\n";
     $controls .= "\t\t<path style=\"fill:none; stroke:#000; stroke-width:1px;\" d=\"M 9 16 A 6 6 0 1 1 15 10\" />\n";
     $controls .= "\t\t<polygon style=\"fill:#000;\" points=\"12,10 18,10 15,14\" />\n";
     $controls .= "\t\t<rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" style=\"opacity:0;\" />\n";
     $controls .= "\t</g>\n";
     // Move left
     $x = 0;
     $y = $this->_y / 2 - 8;
     $controls .= drawArrow($x, $y, 'move_left', 0, 'move_left(15)');
     // Move up
     $x = $this->_x / 2 - 8;
     $y = 20;
     $controls .= drawArrow($x, $y, 'move_up', 90, 'move_up(15)');
     // Move right
     $x = $this->_x - 16;
     $y = $this->_y / 2 - 8;
     $controls .= drawArrow($x, $y, 'move_right', 180, 'move_right(15)');
     // Move down
     $x = $this->_x / 2 - 8;
     $y = $this->_y - 16;
     $controls .= drawArrow($x, $y, 'move_down', -90, 'move_down(15)');
     return $controls;
 }
示例#2
0
 /**
  * Creates controls for moving and rotating the object
  *
  */
 protected function _getControls()
 {
     function drawArrow($x, $y, $id, $rot, $funct)
     {
         $arrow_points = $x + 12 . ',' . ($y + 3) . ' ' . ($x + 3) . ',' . ($y + 8) . ' ' . ($x + 12) . ',' . ($y + 13);
         $arrow = "\t<g id=\"" . $id . '" transform="rotate(' . $rot . ', ' . ($x + 8) . ', ' . ($y + 8) . ')" onclick="' . $funct . "\">\n";
         $arrow .= "\t\t<rect x=\"" . $x . '" y="' . $y . '" width="16" height="16" ' . " style=\"fill:#bbb; stroke:none;\" />\n";
         $arrow .= "\t\t<rect x=\"" . ($x + 1) . '" y="' . ($y + 1) . '" width="14" height="14" ' . " style=\"fill:#ddd; stroke:none;\" />\n";
         $arrow .= "\t\t<polygon points=\"" . $arrow_points . '" ' . " style=\"fill:#000; stroke:none;\" />\n";
         $arrow .= "\t</g>\n";
         return $arrow;
     }
     $controls = "\n\t<!-- Control Elements -->\n";
     // Move left
     $x = 0;
     $y = $this->_y / 2 - 8;
     $controls .= drawArrow($x, $y, 'move_left', 0, 'move_left(15)');
     // Move up
     $x = $this->_x / 2 - 8;
     $y = 0;
     $controls .= drawArrow($x, $y, 'move_up', 90, 'move_up(15)');
     // Move right
     $x = $this->_x - 16;
     $y = $this->_y / 2 - 8;
     $controls .= drawArrow($x, $y, 'move_right', 180, 'move_right(15)');
     // Move down
     $x = $this->_x / 2 - 8;
     $y = $this->_y - 16;
     $controls .= drawArrow($x, $y, 'move_down', -90, 'move_down(15)');
     // Zoom in
     $x = $this->_x * 0.12 - 10;
     $y = $this->_y * 0.88 - 10;
     $controls .= "\t<g id=\"zoom_in\" onclick=\"zoom_in()\">\n";
     $controls .= "\t\t<rect x=\"" . $x . '" y="' . $y . "\" width=\"20\" height=\"20\" style=\"fill:#bbb; stroke:none;\" />\n";
     $controls .= "\t\t<rect x=\"" . ++$x . '" y="' . ++$y . "\" width=\"18\" height=\"18\" style=\"fill:#ddd; stroke:none;\" />\n";
     $controls .= "\t\t<text x=\"" . ++$x . '" y="' . ($y + 17) . "\" " . "style=\"font-size:20pt; font-family:arial, verdana, helvetica, sans-serif;\">+</text>\n";
     $controls .= "\t\t<rect x=\"" . ($x - 2) . '" y="' . $y . "\" width=\"20\" height=\"20\" style=\"opacity: 0;\" />\n";
     $controls .= "\t</g>\n";
     // Zoom out
     $x = $this->_x * 0.88 - 10;
     $y = $this->_y * 0.88 - 10;
     $controls .= "\t<g id=\"zoom_out\" onclick=\"zoom_out()\">\n";
     $controls .= "\t\t<rect x=\"" . $x . '" y="' . $y . "\" width=\"20\" height=\"20\" style=\"fill:#bbb; stroke:none;\" />\n";
     $controls .= "\t\t<rect x=\"" . ++$x . '" y="' . ++$y . "\" width=\"18\" height=\"18\" style=\"fill:#ddd; stroke:none;\" />\n";
     $controls .= "\t\t<text x=\"" . ++$x . '" y="' . ($y + 15) . "\" " . "style=\"font-size:20pt; font-family:arial, verdana, helvetica, sans-serif;\">-</text>\n";
     $controls .= "\t\t<rect x=\"" . ($x - 2) . '" y="' . $y . "\" width=\"20\" height=\"20\" style=\"opacity: 0;\" />\n";
     $controls .= "\t</g>\n";
     // "1:1" - Move to default
     $x = $this->_x * 0.1 - 10;
     $y = $this->_y * 0.1 - 10;
     $controls .= "\t<g id=\"move_to_default\" onclick=\"move_to_default()\">\n";
     $controls .= "\t\t<rect x=\"" . $x . '" y="' . $y . "\" width=\"25\" height=\"25\" style=\"fill:#bbb; stroke:none;\" />\n";
     $controls .= "\t\t<rect x=\"" . ++$x . '" y="' . ++$y . "\" width=\"23\" height=\"23\" style=\"fill:#ddd; stroke:none;\" />\n";
     $controls .= "\t\t<text x=\"" . ++$x . '" y="' . ($y + 16) . "\" " . "style=\"font-size:10pt; font-family:arial, verdana, helvetica, sans-serif;\">1:1</text>\n";
     $controls .= "\t\t<rect x=\"" . ($x - 2) . '" y="' . $y . "\" width=\"25\" height=\"25\" style=\"opacity: 0;\" />\n";
     $controls .= "\t</g>\n";
     return $controls;
 }