Try to make Jeff happy

Make use of a nonce for setting SVG-Edit IDs
option. By default, SVG-Edit behaves as before.
Calling svgCanvas.randomizeIds(true) gives our
behaviour, instead.

Also, sync with latest SVG-Edit (but disable,
for now, manual editing of IDs).
This commit is contained in:
Jacques Distler 2010-02-27 09:49:02 -06:00
parent 8a851eeab2
commit 519f81ab20
8 changed files with 144 additions and 300 deletions

View file

@ -4,6 +4,27 @@ N.B.: You *must* run
after installing the new software, to enjoy the benefits of this new version.
------------------------------------------------------------------------------
* 0.19
New Features:
* WYSIWYG SVG editing (via SVG-edit)
* One-click S5 templates
Bugs Fixed:
* Allow special characters ('.', '/', etc) in page names.
* Fix BlahTeX/PNG path, so equations render in diff and
previous revision pages.
* Fix HTML Export feature so that o uploaded files are
included, stylesheets load, etc.
* Uploaded files inclided in Markup Export.
* Fix Print View, so that uploaded images work.
* Fix some more Ruby 1.9 isues.
* Prevent page from being renamed to null.
* Fix Migration to work under PostgreSQL (from J. Zellman).
------------------------------------------------------------------------------
* 0.18.1

View file

@ -270,10 +270,10 @@ end
module Instiki
module VERSION #:nodoc:
MAJOR = 0
MINOR = 18
TINY = 1
MINOR = 19
TINY = 0
SUFFIX = '(MML+)'
PRERELEASE = false
PRERELEASE = 'pre'
if PRERELEASE
STRING = [MAJOR, MINOR].join('.') + PRERELEASE + SUFFIX
else

View file

@ -91,6 +91,7 @@ function setupSVGedit(path){
window.close();
}
});
editor.svgCanvas.randomizeIds();
editor.svgCanvas.setSvgString(selected);
}, true);
} else {
@ -101,6 +102,7 @@ function setupSVGedit(path){
window.close();
}
});
editor.svgCanvas.randomizeIds();
}, true);
}
SVGeditButton.disabled = true;

View file

@ -13,9 +13,11 @@ $(function() {
var svgcontent = S.svgcontent,
addElem = S.addSvgElementFromJson,
nonce = S.nonce,
randomize_ids = S.randomize_ids,
selElems;
svgCanvas.bind('setarrownonce', setArrowNonce);
svgCanvas.bind('unsetsetarrownonce', unsetArrowNonce);
var lang_list = {
"en":[
@ -27,7 +29,11 @@ $(function() {
};
var prefix = 'se_arrow_';
var arrowprefix = prefix + nonce + '_';
if (randomize_ids) {
var arrowprefix = prefix + nonce + '_';
} else {
var arrowprefix = prefix;
}
var pathdata = {
fw: {d:"m0,0l10,5l-10,5l5,-5l-5,-5z", refx:8, id: arrowprefix + 'fw'},
@ -35,8 +41,16 @@ $(function() {
}
function setArrowNonce(window, n) {
randomize_ids = true;
arrowprefix = prefix + n + '_';
pathdata.fw.id = arrowprefix + 'fw';
pathdata.fw.id = arrowprefix + 'fw';
pathdata.bk.id = arrowprefix + 'bk';
}
function unsetArrowNonce(window) {
randomize_ids = false;
arrowprefix = prefix;
pathdata.fw.id = arrowprefix + 'fw';
pathdata.bk.id = arrowprefix + 'bk';
}

View file

@ -1,291 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 600 600"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
width="48"
height="48"
sodipodi:docname="logo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0"
inkscape:export-filename="logo.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<sodipodi:namedview
inkscape:window-height="858"
inkscape:window-width="911"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
showgrid="false"
inkscape:zoom="11.352818"
inkscape:cx="27.728302"
inkscape:cy="25.018074"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:current-layer="a32" />
<defs
id="defs14280">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective71" />
<linearGradient
gradientUnits="userSpaceOnUse"
id="XMLID_16_"
x1="67.8452"
x2="144.5898"
y1="115.5361"
y2="115.5361">
<stop
id="stop780"
offset="0"
stop-color="#7D7D99" />
<stop
id="stop781"
offset="0.1798"
stop-color="#B1B1C5" />
<stop
id="stop782"
offset="0.3727"
stop-color="#BCBCC8" />
<stop
id="stop783"
offset="0.6825"
stop-color="#C8C8CB" />
<stop
id="stop784"
offset="1"
stop-color="#CCC" />
</linearGradient>
<linearGradient
gradientTransform="matrix(-0.999,4.35e-2,4.35e-2,0.999,-1277.01,-496.517)"
gradientUnits="userSpaceOnUse"
id="XMLID_15_"
x1="-1401.459"
x2="-1354.6851"
y1="595.63092"
y2="699.47632">
<stop
id="stop770"
offset="0"
stop-color="#FFA700" />
<stop
id="stop771"
offset="0.7753"
stop-color="#FFD700" />
<stop
id="stop772"
offset="1"
stop-color="#FF9200" />
</linearGradient>
<linearGradient
gradientTransform="matrix(-0.999,4.35e-2,4.35e-2,0.999,-1277.01,-496.517)"
gradientUnits="userSpaceOnUse"
id="XMLID_14_"
x1="-1336.4497"
x2="-1325.3219"
y1="635.79492"
y2="622.53333">
<stop
id="stop763"
offset="0"
stop-color="#FFC957" />
<stop
id="stop764"
offset="1"
stop-color="#FF6D00" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
id="XMLID_13_"
x1="65.094704"
x2="137.6021"
y1="-0.79540002"
y2="160.1823">
<stop
id="stop750"
offset="0"
stop-color="#FFA700" />
<stop
id="stop751"
offset="0.7753"
stop-color="#FFD700" />
<stop
id="stop752"
offset="1"
stop-color="#FF794B" />
</linearGradient>
<linearGradient
gradientTransform="matrix(-0.999,4.35e-2,4.35e-2,0.999,-1277.01,-496.517)"
gradientUnits="userSpaceOnUse"
id="XMLID_12_"
x1="-1375.9844"
x2="-1355.0455"
y1="685.38092"
y2="706.32172">
<stop
id="stop743"
offset="0"
stop-color="#F8F1DC" />
<stop
id="stop744"
offset="1"
stop-color="#D6A84A" />
</linearGradient>
<linearGradient
gradientTransform="matrix(0.1991,0.98,-0.98,0.1991,91.6944,573.565)"
gradientUnits="userSpaceOnUse"
id="XMLID_11_"
x1="-481.70071"
x2="-360.24561"
y1="-94.419403"
y2="-164.22141">
<stop
id="stop736"
offset="0"
stop-color="#900" />
<stop
id="stop737"
offset="1"
stop-color="#7C0000" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4418">
<rect
height="79.958374"
id="rect4420"
stroke-miterlimit="4"
style="fill:none;stroke:#000000;stroke-width:0.14421287;stroke-miterlimit:4;stroke-dasharray:none"
transform="scale(-1,1)"
width="73.952118"
x="-196.68831"
y="126.58712" />
</clipPath>
</defs>
<metadata
id="metadata30">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<a
xlink:href="http://svg-edit.googlecode.com/"
xlink:title="SVG-edit, an in-browser vector graphics editor"
target="_blank"
id="a32">
<path
sodipodi:type="star"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path3216"
sodipodi:sides="8"
sodipodi:cx="239.79607"
sodipodi:cy="346.96844"
sodipodi:r1="194.03661"
sodipodi:r2="155.59306"
sodipodi:arg1="0.78539816"
sodipodi:arg2="1.1780972"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 377.00067,484.17304 L 299.33895,490.71769 L 239.79607,541.00505 L 180.25318,490.71769 L 102.59147,484.17305 L 96.04682,406.51133 L 45.75946,346.96845 L 96.046819,287.42556 L 102.59147,209.76385 L 180.25318,203.2192 L 239.79607,152.93184 L 299.33895,203.2192 L 377.00067,209.76384 L 383.54531,287.42556 L 433.83267,346.96844 L 383.54531,406.51133 L 377.00067,484.17304 z"
transform="translate(4.1586051,6.9957853)" />
<path
d="M 257.74,558.2 C 282.68,551.18 299.44,533.03 303.3,508.86 L 304.6,500.74 L 310.09,504.65 C 342.6,527.8 385.95,516.69 401.92,481.11 C 410.74,461.44 406.88,429.74 394.39,419.38 C 389.52,415.34 390.73,414.03 400.54,412.71 C 463.81,404.2 466.02,308.53 403.26,294.99 C 389.53,292.02 390.07,292.74 395.81,285.17 C 435.22,233.14 367.98,163.64 313.59,200.18 L 305.09,205.89 L 302.14,193.86 C 286.67,130.77 193.37,133.52 184.62,197.33 C 183.22,207.55 183.54,207.42 175.45,201.25 C 145.54,178.44 96.024,193.52 84.229,229.04 C 77.621,248.93 81.839,276.52 93.036,286.66 C 98.393,291.5 97.7,292.63 88.496,294.06 C 22.466,304.29 22.003,403.73 87.943,412.77 L 96.572,413.95 L 91.187,421.94 C 63.478,463.02 91.34,516.89 140.25,516.79 C 154.94,516.76 170.97,511.38 177.33,504.36 C 181.99,499.22 183.95,499.74 183.95,506.13 C 183.95,538.55 224.9,567.45 257.74,558.2 L 257.74,558.2 z M 224.97,526.08 C 211.13,516.23 207.03,494.21 216.63,481.24 C 220.49,476.01 220.78,473.32 220.78,442.14 L 220.78,408.66 L 196.55,432.83 C 177.87,451.47 172.32,458.16 172.32,462.07 C 172.32,481.92 139.36,496.53 122.68,484.07 C 99.738,466.94 105.5,432.15 132.4,425.3 C 138.8,423.67 144.87,418.74 163.57,399.95 L 186.8,376.62 L 154.85,376.63 C 124.63,376.64 122.38,376.9 113.36,381.47 C 76.809,400.02 46.091,351.65 78.652,326.81 C 88.187,319.54 106.02,319.02 115.45,325.74 C 121.2,329.85 123.45,330.1 154.18,330.1 L 186.8,330.1 L 163.79,307.04 C 147.4,290.61 139.05,283.62 134.78,282.77 C 106.14,277.04 98.685,240.4 122.56,222.71 C 139.4,210.23 172.44,224.79 172.28,244.63 C 172.25,248.57 177.44,254.67 196.02,272.54 L 219.81,295.41 L 220.34,263.32 C 220.84,233.01 220.64,230.91 216.67,225.55 C 202.3,206.11 216.23,177.52 241.09,175.46 C 267.18,173.29 284.31,199.14 272.29,222.54 C 267.54,231.79 267.31,233.68 267.3,264.18 L 267.29,296.13 L 290.36,273.12 C 306.39,257.14 313.79,248.33 314.59,244.3 C 320.55,214.53 361.13,208.27 375.2,234.95 C 385.62,254.7 375.71,276.27 353.68,281.82 C 346.89,283.53 341.33,288 322.38,307 L 299.33,330.1 L 332.92,330.1 C 363.2,330.1 367.04,329.73 371.86,326.3 C 384.69,317.16 402.12,319.56 413.39,332.03 C 438.43,359.76 402.17,402.01 371.86,380.43 C 367.04,377 363.2,376.62 332.92,376.62 L 299.33,376.62 L 322.38,399.72 C 341.33,418.73 346.89,423.2 353.68,424.91 C 390.29,434.13 386.87,485.55 349.44,488.65 C 332.45,490.06 313.81,474.97 313.81,459.8 C 313.81,458.26 303.34,446.56 290.55,433.8 L 267.29,410.6 L 267.3,442.55 C 267.31,472.77 267.57,475.02 272.15,484.03 C 287.66,514.61 252.66,545.8 224.97,526.08 L 224.97,526.08 z"
id="path34"
style="fill:#000000" />
<g
clip-path="url(#clipPath4418)"
transform="matrix(-4.6717475,0,0,4.6717475,1143.4575,-562.74962)"
id="g36">
<path
d="M 191.92,195.98 C 180.31,159.86 178.21,153.31 177.06,151.92 C 177.18,152 177.35,152.1 177.35,152.1 L 98.804,64.643 C 94.609,59.993 84.799,64.999 77.449,71.619 C 70.166,78.161 64.129,87.392 68.079,92.183 L 147.02,179.73 L 147.56,179.82 L 185.32,197.42 L 193.01,199.79 L 191.92,195.98 L 191.92,195.98 z"
id="path38"
style="opacity:0.2" />
<path
d="M 193.56,193.52 C 181.95,157.39 179.84,150.85 178.7,149.45 C 178.82,149.52 178.99,149.63 178.99,149.63 L 100.44,62.175 C 96.245,57.524 86.429,62.53 79.083,69.15 C 71.802,75.695 65.763,84.923 69.715,89.716 L 148.66,177.26 L 149.19,177.36 L 186.96,194.95 L 194.64,197.32 L 193.56,193.52 L 193.56,193.52 z"
id="path40"
style="opacity:0.2" />
<path
d="M 186.77,191.05 C 175.16,154.92 173.06,148.38 171.91,146.98 C 172.03,147.06 172.2,147.16 172.2,147.16 L 93.653,59.704 C 89.461,55.054 79.644,60.063 72.299,66.682 C 65.016,73.224 58.978,82.453 62.93,87.247 L 141.87,174.79 L 142.41,174.88 L 180.18,192.48 L 187.86,194.85 L 186.77,191.05 L 186.77,191.05 z"
id="path42"
style="opacity:0.2" />
<path
d="M 186.43,189.36 C 174.82,153.23 172.72,146.69 171.57,145.29 C 171.69,145.37 171.86,145.47 171.86,145.47 L 93.314,58.016 C 89.115,53.365 79.299,58.373 71.955,64.993 C 64.672,71.536 58.633,80.767 62.585,85.559 L 141.53,173.1 L 142.06,173.2 L 179.83,190.8 L 187.52,193.16 L 186.43,189.36 L 186.43,189.36 z"
id="path44"
style="fill:#ffffff" />
<path
d="M 186.43,189.36 C 174.82,153.23 172.72,146.69 171.57,145.29 C 171.69,145.37 171.86,145.47 171.86,145.47 L 93.314,58.016 C 89.115,53.365 79.299,58.373 71.955,64.993 C 64.672,71.536 58.633,80.767 62.585,85.559 L 141.53,173.1 L 142.06,173.2 L 179.83,190.8 L 187.52,193.16 L 186.43,189.36 L 186.43,189.36 z"
id="path46"
style="fill:url(#XMLID_11_)" />
<path
d="M 166.97,147.76 L 180.69,185.89 L 144.32,167.99 L 144.49,167.84 C 144.24,167.76 143.99,167.66 143.79,167.52 L 143.66,167.64 L 68.36,84.072 L 68.483,83.968 C 66.237,81.478 69.515,74.874 75.791,69.216 C 82.071,63.564 88.971,60.997 91.216,63.483 L 166.51,147.05 L 166.97,147.76 L 166.97,147.76 z"
id="path48"
style="fill:url(#XMLID_12_)" />
<path
d="M 148.65,170.12 C 150.73,169.75 153.29,168.64 155.9,166.98 C 157.52,165.96 159.18,164.7 160.8,163.24 C 162.26,161.94 163.54,160.57 164.64,159.23 C 166.72,156.7 167.96,154.02 168.42,151.8 L 166.97,147.76 L 166.5,147.05 L 91.707,64.028 C 92.315,66.268 90.745,69.966 87.644,73.768 C 86.51,75.157 85.203,76.557 83.699,77.909 C 82.125,79.328 80.504,80.561 78.932,81.563 C 74.439,84.434 70.304,85.491 68.384,84.049 L 68.359,84.07 L 143.66,167.64 L 143.79,167.52 C 143.99,167.66 144.24,167.76 144.49,167.84 L 144.32,167.99 L 148.65,170.12 L 148.65,170.12 z"
id="path50"
style="fill:url(#XMLID_13_)" />
<path
d="M 68.083,83.41 C 69.815,85.182 74.077,84.186 78.726,81.216 C 80.267,80.234 81.858,79.023 83.403,77.63 C 84.879,76.305 86.162,74.929 87.275,73.567 C 90.853,69.179 92.366,64.925 90.752,62.983 L 90.775,62.959 L 166.59,147.08 C 167.23,149.34 166,153.58 162.84,157.44 C 161.76,158.75 160.5,160.09 159.07,161.37 C 157.48,162.8 155.85,164.04 154.26,165.04 C 149.52,168.05 144.96,169.24 143.24,167.35 C 142.85,166.91 141.15,165.01 141.1,164.94 L 67.845,83.626 L 68.083,83.41 L 68.083,83.41 z"
id="path52"
style="fill:#ffffff" />
<path
d="M 75.79,69.215 C 82.07,63.563 88.97,60.996 91.215,63.482 L 108.18,82.31 L 109.33,108.8 L 91.355,109.58 L 68.359,84.071 L 68.482,83.967 C 66.236,81.477 69.514,74.874 75.79,69.215 L 75.79,69.215 z"
id="path54"
style="fill:#ffffff" />
<path
d="M 68.083,83.41 C 69.815,85.182 74.077,84.186 78.726,81.216 C 80.267,80.234 81.858,79.023 83.403,77.63 C 84.879,76.305 86.162,74.929 87.275,73.567 C 90.853,69.179 92.366,64.925 90.752,62.983 L 90.775,62.959 L 166.59,147.08 C 167.23,149.34 166,153.58 162.84,157.44 C 161.76,158.75 160.5,160.09 159.07,161.37 C 157.48,162.8 155.85,164.04 154.26,165.04 C 149.52,168.05 144.96,169.24 143.24,167.35 C 142.85,166.91 141.15,165.01 141.1,164.94 L 67.845,83.626 L 68.083,83.41 L 68.083,83.41 z"
id="path56"
style="fill:#ffffff" />
<path
d="M 75.79,69.215 C 82.07,63.563 88.97,60.996 91.215,63.482 L 108.18,82.31 L 109.33,108.8 L 91.355,109.58 L 68.359,84.071 L 68.482,83.967 C 66.236,81.477 69.514,74.874 75.79,69.215 L 75.79,69.215 z"
id="path58"
style="fill:url(#XMLID_14_)" />
<path
d="M 68.083,83.41 C 69.815,85.182 74.077,84.186 78.726,81.216 C 80.267,80.234 81.858,79.023 83.403,77.63 C 84.879,76.305 86.162,74.929 87.275,73.567 C 90.853,69.179 92.366,64.925 90.752,62.983 L 90.775,62.959 L 166.59,147.08 C 167.23,149.34 166,153.58 162.84,157.44 C 161.76,158.75 160.5,160.09 159.07,161.37 C 157.48,162.8 155.85,164.04 154.26,165.04 C 149.52,168.05 144.96,169.24 143.24,167.35 C 142.85,166.91 141.15,165.01 141.1,164.94 L 67.845,83.626 L 68.083,83.41 L 68.083,83.41 z"
id="path60"
style="fill:url(#XMLID_15_)" />
<path
d="M 74.357,90.713 C 74.357,90.713 80.393,90.501 85.042,87.531 C 86.584,86.548 88.174,85.338 89.719,83.945 C 91.196,82.619 92.479,81.244 93.592,79.881 C 96.52,76.292 98.061,72.793 97.641,70.574 L 90.776,62.957 L 90.753,62.981 C 92.367,64.923 90.855,69.177 87.276,73.565 C 86.163,74.927 84.88,76.303 83.404,77.628 C 81.859,79.021 80.268,80.232 78.727,81.214 C 74.079,84.185 69.817,85.181 68.084,83.408 L 67.846,83.625 L 141.1,164.94 C 141.15,165.01 142.85,166.9 143.25,167.34 C 143.59,167.72 144.05,167.97 144.59,168.11 L 74.357,90.713 L 74.357,90.713 z"
id="path62"
style="fill:url(#XMLID_16_)" />
<path
d="M 172.04,175.35 C 170.4,176.83 168.73,178.12 167.09,179.19 L 180.69,185.89 L 175.6,171.74 C 174.54,172.95 173.35,174.18 172.04,175.35 z"
id="path64"
style="fill:#003333" />
<path
d="M 163.12,157.05 L 86.968,73.93 C 87.068,73.81 87.181,73.688 87.275,73.566 C 88.703,71.814 89.795,70.076 90.5,68.508 L 166.27,151.22 C 165.72,153.04 164.67,155.08 163.12,157.05 L 163.12,157.05 z"
id="path66"
style="opacity:0.5;fill:#ffffff" />
<path
d="M 87.275,73.566 C 87.909,72.792 88.464,72.018 88.969,71.266 L 164.98,154.24 C 164.41,155.3 163.7,156.39 162.84,157.43 C 162.09,158.33 161.27,159.24 160.37,160.13 L 84.152,76.932 C 85.316,75.824 86.361,74.692 87.275,73.566 L 87.275,73.566 z"
id="path68"
style="opacity:0.5;fill:#ffffff" />
</g>
</a>
<svg viewBox="0 0 478 472" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="svg_5" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffffe0" stop-opacity="1"/>
<stop offset="1" stop-color="#edc39c" stop-opacity="1"/>
</linearGradient>
<linearGradient id="svg_10" x1="0.57031" y1="0.78125" x2="0.28906" y2="0.41406">
<stop offset="0" stop-color="#ff7f00" stop-opacity="1"/>
<stop offset="1" stop-color="#ffff00"/>
</linearGradient>
<linearGradient id="svg_18" x1="0.37891" y1="0.35938" x2="1" y2="1">
<stop offset="0" stop-color="#e0e0e0" stop-opacity="1"/>
<stop offset="1" stop-color="#666666" stop-opacity="1"/>
</linearGradient>
</defs>
<g>
<title>Layer 1</title>
<path d="m68.82031,270.04688l-22,-33l17,-35l34,2l25,15l7,-35l28,-16l25,12l100,102l21,23l-15,35l-36,9l20,49l-31,24l-49,-17l-1,31l-33,21l-31,-19l-13,-35l-30,21l-30,-9l-5,-35l16,-31l-32,-6l-15,-19l3,-36l47,-18z" id="svg_19" fill="#ffffff"/>
<path fill="#1a171a" fill-rule="nonzero" id="path2902" d="m158.96452,155.03685c-25.02071,0 -45.37077,20.35121 -45.37077,45.3775c0,0.72217 0.01794,1.4399 0.0471,2.15645c-0.49339,-0.53604 -0.99355,-1.06085 -1.50603,-1.58452c-8.56077,-8.55519 -19.95982,-13.28413 -32.07432,-13.28413c-12.12122,0 -23.52027,4.72334 -32.08778,13.29646c-17.69347,17.69464 -17.69347,46.4619 0,64.17445c0.51809,0.51697 1.0485,1.0126 1.59015,1.50601c-0.72891,-0.03586 -1.45782,-0.04822 -2.19234,-0.04822c-25.02071,0 -45.37189,20.35117 -45.37189,45.37747c0,25.01398 20.35119,45.36517 45.37189,45.36517c0.72891,0 1.45221,-0.01236 2.1744,-0.04828c-0.5293,0.48221 -1.05412,0.98801 -1.56547,1.49368c-17.70021,17.68906 -17.70021,46.48654 -0.00628,64.18677c8.57872,8.56747 19.96655,13.2785 32.08778,13.2785c12.1145,0 23.5012,-4.71103 32.07433,-13.2785c0.51247,-0.51694 1.01823,-1.04849 1.50603,-1.57895c-0.02915,0.71213 -0.04709,1.44669 -0.04709,2.15759c0,25.01511 20.35007,45.37747 45.37077,45.37747c25.01398,0 45.37079,-20.3624 45.37079,-45.37747c0,-0.7222 -0.01689,-1.44553 -0.05266,-2.18112c0.48105,0.52933 0.97562,1.04849 1.48697,1.56662c8.57982,8.57977 19.97775,13.2908 32.1057,13.2908c12.11003,0 23.51358,-4.71103 32.0687,-13.2785c17.68906,-17.70013 17.68906,-46.48538 0,-64.17441c-0.50577,-0.4946 -1.01141,-1.00034 -1.54306,-1.48248c0.69983,0.03592 1.42316,0.04828 2.16992,0.04828c25.01514,0 45.35284,-20.35123 45.35284,-45.36517c0,-25.02631 -20.33774,-45.37747 -45.35284,-45.37747c-0.74683,0 -1.47009,0.01236 -2.19345,0.04822c0.53152,-0.49341 1.06082,-0.98904 1.59128,-1.50601c8.55521,-8.55521 13.2785,-19.94186 13.2785,-32.07545c0,-12.12793 -4.72336,-23.52028 -13.30319,-32.0934c-8.55515,-8.56076 -19.95866,-13.2841 -32.0687,-13.2841c-12.12122,0 -23.52025,4.72334 -32.08777,13.2841c-0.51137,0.5181 -1.01822,1.04851 -1.5049,1.57895c0.03586,-0.72331 0.05266,-1.43991 0.05266,-2.16881c0,-25.02629 -20.35681,-45.3775 -45.37079,-45.3775m0,20.71901c13.61607,0 24.65851,11.03122 24.65851,24.65849c0,6.62749 -2.651,12.62137 -6.9101,17.04979l0,51.67419l36.53975,-36.53523c0.12001,-6.14418 2.48277,-12.24686 7.18146,-16.94667c4.81305,-4.81305 11.12094,-7.22409 17.44116,-7.22409c6.30228,0 12.61577,2.41104 17.43552,7.22409c9.62166,9.63287 9.62166,25.24948 0,34.87669c-4.69977,4.68634 -10.80803,7.04915 -16.95334,7.18147l-36.5341,36.53305l51.66742,0c4.42841,-4.25351 10.42905,-6.90451 17.08008,-6.90451c13.59137,0 24.62933,11.03799 24.62933,24.66525c0,13.61606 -11.03796,24.66519 -24.62933,24.66519c-6.65106,0 -12.65167,-2.66333 -17.08008,-6.91681l-51.64836,0l36.50273,36.50946c6.16995,0.14465 12.26587,2.50522 16.96568,7.20618c9.6216,9.61487 9.6216,25.23151 0,34.85757c-4.80856,4.81979 -11.13327,7.22974 -17.43556,7.22974c-6.32019,0 -12.63371,-2.40991 -17.44786,-7.22974c-4.68074,-4.68744 -7.04802,-10.79572 -7.17473,-16.94098l-36.53975,-36.53415l0,51.66742c4.25908,4.44635 6.9101,10.43466 6.9101,17.0621c0,13.62729 -11.04243,24.66415 -24.65851,24.66415c-13.62166,0 -24.65848,-11.0369 -24.65848,-24.66415c0,-6.62744 2.64539,-12.61575 6.90335,-17.0621l0,-51.66742l-36.53864,36.54648c-0.12672,6.14413 -2.48838,12.26477 -7.18147,16.94098c-4.81416,4.81873 -11.12206,7.22974 -17.42882,7.22974c-6.31461,0 -12.6225,-2.41101 -17.43555,-7.22974c-9.63284,-9.62833 -9.63284,-25.24277 0,-34.8699c4.68073,-4.67627 10.79012,-7.05026 16.94101,-7.18262l36.533,-36.53302l-51.66632,0c-4.44075,4.25348 -10.42902,6.91681 -17.06211,6.91681c-13.61606,0 -24.65288,-11.04913 -24.65288,-24.66519c0,-13.62726 11.03682,-24.66525 24.65288,-24.66525c6.63309,0 12.62136,2.651 17.06211,6.90451l51.68537,0l-36.55208,-36.54538c-6.14527,-0.12 -12.25354,-2.49403 -16.94775,-7.19377c-9.62611,-9.61493 -9.62611,-25.23715 0,-34.86441c4.81419,-4.81305 11.12769,-7.22406 17.44228,-7.22406c6.30676,0 12.61465,2.41101 17.42883,7.22406c4.69978,4.69307 7.06034,10.80246 7.18144,16.94777l36.5386,36.53299l0,-51.66074c-4.25795,-4.42841 -6.90334,-10.42229 -6.90334,-17.04979c0,-13.62726 11.03682,-24.65848 24.65848,-24.65848"/>
<path d="m188.82031,210.04688l16,-47l155,-148l107,100l-158,156.99999l-44,12l-76,-74z" id="svg_6" fill="url(#svg_10)" stroke="#ffffff" stroke-width="0"/>
<path d="m335.57031,40.29688c-11.5,39.75 55.5,115.25 109.25,98.75l21,-20.99999l-103,-101l-27.25,23.25z" id="svg_11" fill="url(#svg_18)" stroke="#ffffff" stroke-width="0"/>
<rect x="272.80404" y="20.76382" width="42.35197" height="232.66835" id="svg_13" fill="#ffffff" stroke="#ffffff" stroke-width="0" transform="rotate(45.9094, 293.98, 137.1)" opacity="0.4"/>
<rect x="282.80404" y="22.76382" width="14" height="232.66835" fill="#ffffff" stroke="#ffffff" stroke-width="0" transform="rotate(45.9094, 289.805, 139.1)" opacity="0.4" id="svg_14"/>
<ellipse cx="415.13312" cy="64.38066" id="svg_12" fill="#ea7598" stroke="#ffffff" stroke-width="0" rx="67.79251" ry="34.82026" transform="rotate(39.4735, 415.133, 64.379)"/>
<path d="m212.07031,166.04688c-8.5,47 36.25,103.75 99.25,96.75l-152.5,53.25l53.25,-150z" id="svg_4" fill="url(#svg_5)" stroke="#ffffff" stroke-width="0"/>
<path d="m181.32031,242.54688c0.5,20.5 26.75,45 46.75,48.5l-66.25,20l19.5,-68.5z" id="svg_3" fill="#27382f" stroke="#ffffff" stroke-width="0"/>
</g>
<g>
<title>Layer 2</title>
<path d="m152.82031,317.04688l51,-152l157,-153c40,-12.00001 118,48 105,105l-157,152.99999l-156,47z" id="svg_1" fill="none" stroke="#800000" stroke-width="17"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -156,6 +156,12 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
<div class="push_button" id="tool_topath" title="Convert to Path"></div>
<div class="push_button" id="tool_reorient" title="Reorient path"></div>
<div class="tool_sep"></div>
<!--
<label>
<span>id:</span>
<input id="elem_id" class="attr_changer" data-attr="id" size="10" type="text" title="Identify the element"/>
</label>
-->
</div>
<div class="toolset" id="tool_opacity">
<label>

View file

@ -665,6 +665,7 @@ function svg_edit_setup() {
};
// updates the toolbar (colors, opacity, etc) based on the selected element
// This function also updates the opacity and id elements that are in the context panel
var updateToolbar = function() {
if (selectedElement != null &&
selectedElement.tagName != "image" &&
@ -727,6 +728,7 @@ function svg_edit_setup() {
var opac_perc = ((selectedElement.getAttribute("opacity")||1.0)*100);
$('#group_opacity').val(opac_perc);
$('#opac_slider').slider('option', 'value', opac_perc);
$('#elem_id').val(selectedElement.id);
}
updateToolButtonState();
@ -1034,7 +1036,17 @@ function svg_edit_setup() {
this.value = selectedElement.getAttribute(attr);
return false;
}
// if the user is changing the id, then de-select the element first
// change the ID, then re-select it with the new ID
if (attr == "id") {
var elem = selectedElement;
svgCanvas.clearSelection();
elem.id = val;
svgCanvas.addToSelection([elem],true);
}
else {
svgCanvas.changeSelectedAttribute(attr, val);
}
});
// Prevent selection of elements when shift-clicking
@ -2778,7 +2790,7 @@ function svg_edit_setup() {
updateCanvas(true);
});
// var revnums = "svg-editor.js ($Rev: 1430 $) ";
// var revnums = "svg-editor.js ($Rev: 1433 $) ";
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute("title", revnums);
return svgCanvas;

View file

@ -945,6 +945,7 @@ function BatchCommand(text) {
//nonce to uniquify id's
var nonce = Math.floor(Math.random()*100001);
var randomize_ids = false;
// map namespace URIs to prefixes
var nsMap = {};
@ -986,9 +987,9 @@ function BatchCommand(text) {
overflow: 'visible',
xmlns: svgns,
"xmlns:se": se_ns,
"se:nonce": nonce,
"xmlns:xlink": xlinkns
}).appendTo(svgroot);
if (randomize_ids) svgContent.setAttributeNS(se_ns, nonce);
var convertToNum, convertToUnit, setUnitAttr;
@ -1071,6 +1072,20 @@ function BatchCommand(text) {
if(re.test(val)) valid = true;
});
}
} else if (attr == "id") {
// if we're trying to change the id, make sure it's not already present in the doc
// and the id value is valid.
var result = false;
// because getElem() can throw an exception in the case of an invalid id
// (according to http://www.w3.org/TR/xml-id/ IDs must be a NCName)
// we wrap it in an exception and only return true if the ID was valid and
// not already present
try {
var elem = getElem(val);
result = (elem == null);
} catch(e) {}
return result;
} else valid = true;
return valid;
@ -1289,7 +1304,11 @@ function BatchCommand(text) {
// private functions
var getId = function() {
if (events["getid"]) return call("getid", obj_num);
return idprefix + nonce +'_' + obj_num;
if (randomize_ids) {
return idprefix + nonce +'_' + obj_num;
} else {
return idprefix + obj_num;
}
};
var getNextId = function() {
@ -5525,6 +5544,27 @@ function BatchCommand(text) {
return svgCanvasToString();
};
//function randomizeIds
// This function determines whether to add a nonce to the prefix, when
// generating IDs in SVG-Edit
//
// Parameters:
// an opional boolean, which, if true, adds a nonce to the prefix. Thus
// svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true)
//
// if you're controlling SVG-Edit externally, and want randomized IDs, call
// this BEFORE calling svgCanvas.setSvgString
//
this.randomizeIds = function() {
if (arguments.length > 0 && arguments[0] == false) {
randomize_ids = false;
if (extensions["Arrows"]) call("unsetarrownonce") ;
} else {
randomize_ids = true;
}
}
//
// Function: setSvgString
// This function sets the current drawing as the input SVG XML.
//
@ -5551,11 +5591,13 @@ function BatchCommand(text) {
// retrieve or set the nonce
n = svgcontent.getAttributeNS(se_ns, 'nonce');
if (n) {
randomize_ids = true;
nonce = n;
if (extensions["Arrows"]) call("setarrownonce", n) ;
} else {
} else if (randomize_ids) {
svgcontent.setAttributeNS(xmlnsns, 'xml:se', se_ns);
svgcontent.setAttributeNS(se_ns, 'se:nonce', nonce);
if (extensions["Arrows"]) call("setarrownonce", nonce) ;
}
// change image href vals if possible
$(svgcontent).find('image').each(function() {
@ -5650,6 +5692,11 @@ function BatchCommand(text) {
// Returns:
// This function returns false if the import was unsuccessful, true otherwise.
// TODO: properly handle if namespace is introduced by imported content (must add to svgcontent
// and update all prefixes in the imported node)
// TODO: properly handle recalculating dimensions, recalculateDimensions() doesn't handle
// arbitrary transform lists, but makes some assumptions about how the transform list
// was obtained
// TODO: import should happen in top-left of current zoomed viewport
// TODO: create a new layer for the imported SVG
this.importSvgString = function(xmlString) {
@ -7908,7 +7955,7 @@ function BatchCommand(text) {
// Function: getVersion
// Returns a string which describes the revision number of SvgCanvas.
this.getVersion = function() {
return "svgcanvas.js ($Rev: 1431 $)";
return "svgcanvas.js ($Rev: 1433 $)";
};
this.setUiStrings = function(strs) {
@ -8200,4 +8247,5 @@ var Utils = {
catch(e){ throw new Error("Error parsing XML string"); };
return out;
}
};