Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First import of SVG-edit code from trunk
- Loading branch information
adityab
committed
Apr 6, 2012
1 parent
143b9b1
commit 5b77ed0
Showing
228 changed files
with
47,889 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Awwation: | ||
|
||
Aditya Bhatt <aditya@adityabhatt.org> | ||
|
||
SVG-edit: | ||
|
||
Narendra Sisodiya <narendra.sisodiya@gmail.com> | ||
Pavol Rusnak <rusnakp@gmail.com> | ||
Jeff Schiller <codedread@gmail.com> | ||
Vidar Hokstad <vidar.hokstad@gmail.com> | ||
Alexis Deveria <adeveria@gmail.com> | ||
|
||
Translation credits: | ||
|
||
ar: Tarik Belaam <dubraise@gmail.com> (العربية) | ||
cs: Jan Ptacek <jan.ptacek@gmail.com> (Čeština) | ||
de: Reimar Bauer <rb.proj@googlemail.com> (Deutsch) | ||
es: Alicia Puerto <alicia.puerto.g@gmail.com> (Español) | ||
fa: Payman Delshad <payman@opera.com> (فارسی) | ||
fr: wormsxulla <wormsxulla@yahoo.com> (Français) | ||
fy: Wander Nauta <info@wandernauta.nl> (Frysk) | ||
hi: Tavish Naruka <tavishnaruka@gmail.com> (हिन्दी) | ||
ja: Dong <iwadon@yarhalla.jpn.org> (日本語) | ||
nl: Jaap Blom <jaap.blom@gmail.com> (Nederlands) | ||
ro: Christian Tzurcanu <christian.tzurcanu@gmail.com> (Româneşte) | ||
ru: Laurent Dufloux <laurent.dufloux@etu.upmc.fr> (Русский) | ||
sk: Pavol Rusnak <rusnakp@gmail.com> (Slovenčina) | ||
zh-TW: 黃瀚生 (Han Sheng Huang) <zenixls2@gmail.com> (台灣正體) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2009-2011 by SVG-edit authors (see AUTHORS file) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Awwation | ||
|
||
This is an HTML5 Prezi clone app using SVG and Javascript. | ||
It is made using **SVG-edit**, an awesome client-side SVG editor. | ||
It uses **Sozi** for animating the presentation. | ||
|
||
|
||
This is a **Hack** right now, and was written mostly as an experiment to determine how easy it would be to build something like Prezi using modern browser tech. The code is buggy and will hopefully become better over time. I welcome people to contribute changes once I set the code in order. | ||
|
||
The 'results' of the experiment are detailed in my blog post here: http://adityabhatt.wordpress.com/2012/04/06/writing-a-prezi-clone-with-html5-svg-and-javascript/ | ||
|
||
**This is the Master branch of Awwwation. I am rewriting the code from scratch, nicely in this branch, till it gets to the state of progress in the online gh-pages branch. Then this one will be put online.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="chrome=1"/> | ||
<link rel="icon" type="image/png" href="images/logo.png"/> | ||
<link rel="stylesheet" href="svg-editor.css" type="text/css"/> | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<title>Browser does not support SVG | SVG-edit</title> | ||
</head> | ||
<body> | ||
|
||
<div id="browser-not-supported"> | ||
<img style="float:left;padding:10px;" src="images/logo.png" width="48" height="48" alt="SVG-edit logo" /><br /> | ||
<p>Sorry, but your browser does not support SVG. Below is a list of alternate browsers and versions that support SVG and SVG-edit (from <a href="http://caniuse.com/#cats=SVG">caniuse.com</a>).</p> | ||
<p>Try the latest version of <a href="http://www.getfirefox.com">Firefox</a>, <a href="http://www.google.com/chrome/">Google Chrome</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, <a href="http://www.opera.com/download/">Opera</a> or <a href="http://windows.microsoft.com/ie9">Internet Explorer<a/>.</p> | ||
<p>If you are unable to install one of these and must use an old version of Internet Explorer, you can install the <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame plugin</a>.</p> | ||
|
||
<script type="text/javascript"> | ||
var viewportHeight =(window.innerHeight ? window.innerHeight : $(window).height()) - 140; | ||
document.write('<iframe width="100%" height="'+viewportHeight+'" src="http://caniuse.com/#cats=SVG"></iframe>'); | ||
</script> | ||
|
||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
/** | ||
* Package: svgedit.browser | ||
* | ||
* Licensed under the Apache License, Version 2 | ||
* | ||
* Copyright(c) 2010 Jeff Schiller | ||
* Copyright(c) 2010 Alexis Deveria | ||
*/ | ||
|
||
// Dependencies: | ||
// 1) jQuery (for $.alert()) | ||
|
||
var svgedit = svgedit || {}; | ||
|
||
(function() { | ||
|
||
if (!svgedit.browser) { | ||
svgedit.browser = {}; | ||
} | ||
var supportsSvg_ = (function() { | ||
return !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect; | ||
})(); | ||
svgedit.browser.supportsSvg = function() { return supportsSvg_; } | ||
if(!svgedit.browser.supportsSvg()) { | ||
window.location = "browser-not-supported.html"; | ||
} | ||
else{ | ||
|
||
var svgns = 'http://www.w3.org/2000/svg'; | ||
var userAgent = navigator.userAgent; | ||
var svg = document.createElementNS(svgns, 'svg'); | ||
|
||
// Note: Browser sniffing should only be used if no other detection method is possible | ||
var isOpera_ = !!window.opera; | ||
var isWebkit_ = userAgent.indexOf("AppleWebKit") >= 0; | ||
var isGecko_ = userAgent.indexOf('Gecko/') >= 0; | ||
var isIE_ = userAgent.indexOf('MSIE') >= 0; | ||
var isChrome_ = userAgent.indexOf('Chrome/') >= 0; | ||
var isWindows_ = userAgent.indexOf('Windows') >= 0; | ||
var isMac_ = userAgent.indexOf('Macintosh') >= 0; | ||
|
||
var supportsSelectors_ = (function() { | ||
return !!svg.querySelector; | ||
})(); | ||
|
||
var supportsXpath_ = (function() { | ||
return !!document.evaluate; | ||
})(); | ||
|
||
// segList functions (for FF1.5 and 2.0) | ||
var supportsPathReplaceItem_ = (function() { | ||
var path = document.createElementNS(svgns, 'path'); | ||
path.setAttribute('d','M0,0 10,10'); | ||
var seglist = path.pathSegList; | ||
var seg = path.createSVGPathSegLinetoAbs(5,5); | ||
try { | ||
seglist.replaceItem(seg, 0); | ||
return true; | ||
} catch(err) {} | ||
return false; | ||
})(); | ||
|
||
var supportsPathInsertItemBefore_ = (function() { | ||
var path = document.createElementNS(svgns,'path'); | ||
path.setAttribute('d','M0,0 10,10'); | ||
var seglist = path.pathSegList; | ||
var seg = path.createSVGPathSegLinetoAbs(5,5); | ||
try { | ||
seglist.insertItemBefore(seg, 0); | ||
return true; | ||
} catch(err) {} | ||
return false; | ||
})(); | ||
|
||
// text character positioning (for IE9) | ||
var supportsGoodTextCharPos_ = (function() { | ||
var retValue = false; | ||
var svgroot = document.createElementNS(svgns, 'svg'); | ||
var svgcontent = document.createElementNS(svgns, 'svg'); | ||
document.documentElement.appendChild(svgroot); | ||
svgcontent.setAttribute('x', 5); | ||
svgroot.appendChild(svgcontent); | ||
var text = document.createElementNS(svgns,'text'); | ||
text.textContent = 'a'; | ||
svgcontent.appendChild(text); | ||
var pos = text.getStartPositionOfChar(0).x; | ||
document.documentElement.removeChild(svgroot); | ||
return (pos === 0); | ||
})(); | ||
|
||
var supportsPathBBox_ = (function() { | ||
var svgcontent = document.createElementNS(svgns, 'svg'); | ||
document.documentElement.appendChild(svgcontent); | ||
var path = document.createElementNS(svgns, 'path'); | ||
path.setAttribute('d','M0,0 C0,0 10,10 10,0'); | ||
svgcontent.appendChild(path); | ||
var bbox = path.getBBox(); | ||
document.documentElement.removeChild(svgcontent); | ||
return (bbox.height > 4 && bbox.height < 5); | ||
})(); | ||
|
||
// Support for correct bbox sizing on groups with horizontal/vertical lines | ||
var supportsHVLineContainerBBox_ = (function() { | ||
var svgcontent = document.createElementNS(svgns, 'svg'); | ||
document.documentElement.appendChild(svgcontent); | ||
var path = document.createElementNS(svgns, 'path'); | ||
path.setAttribute('d','M0,0 10,0'); | ||
var path2 = document.createElementNS(svgns, 'path'); | ||
path2.setAttribute('d','M5,0 15,0'); | ||
var g = document.createElementNS(svgns, 'g'); | ||
g.appendChild(path); | ||
g.appendChild(path2); | ||
svgcontent.appendChild(g); | ||
var bbox = g.getBBox(); | ||
document.documentElement.removeChild(svgcontent); | ||
// Webkit gives 0, FF gives 10, Opera (correctly) gives 15 | ||
return (bbox.width == 15); | ||
})(); | ||
|
||
var supportsEditableText_ = (function() { | ||
// TODO: Find better way to check support for this | ||
return isOpera_; | ||
})(); | ||
|
||
var supportsGoodDecimals_ = (function() { | ||
// Correct decimals on clone attributes (Opera < 10.5/win/non-en) | ||
var rect = document.createElementNS(svgns, 'rect'); | ||
rect.setAttribute('x',.1); | ||
var crect = rect.cloneNode(false); | ||
var retValue = (crect.getAttribute('x').indexOf(',') == -1); | ||
if(!retValue) { | ||
$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\ | ||
Please upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed."); | ||
} | ||
return retValue; | ||
})(); | ||
|
||
var supportsNonScalingStroke_ = (function() { | ||
var rect = document.createElementNS(svgns, 'rect'); | ||
rect.setAttribute('style','vector-effect:non-scaling-stroke'); | ||
return rect.style.vectorEffect === 'non-scaling-stroke'; | ||
})(); | ||
|
||
var supportsNativeSVGTransformLists_ = (function() { | ||
var rect = document.createElementNS(svgns, 'rect'); | ||
var rxform = rect.transform.baseVal; | ||
|
||
var t1 = svg.createSVGTransform(); | ||
rxform.appendItem(t1); | ||
return rxform.getItem(0) == t1; | ||
})(); | ||
|
||
// Public API | ||
|
||
svgedit.browser.isOpera = function() { return isOpera_; } | ||
svgedit.browser.isWebkit = function() { return isWebkit_; } | ||
svgedit.browser.isGecko = function() { return isGecko_; } | ||
svgedit.browser.isIE = function() { return isIE_; } | ||
svgedit.browser.isChrome = function() { return isChrome_; } | ||
svgedit.browser.isWindows = function() { return isWindows_; } | ||
svgedit.browser.isMac = function() { return isMac_; } | ||
|
||
svgedit.browser.supportsSelectors = function() { return supportsSelectors_; } | ||
svgedit.browser.supportsXpath = function() { return supportsXpath_; } | ||
|
||
svgedit.browser.supportsPathReplaceItem = function() { return supportsPathReplaceItem_; } | ||
svgedit.browser.supportsPathInsertItemBefore = function() { return supportsPathInsertItemBefore_; } | ||
svgedit.browser.supportsPathBBox = function() { return supportsPathBBox_; } | ||
svgedit.browser.supportsHVLineContainerBBox = function() { return supportsHVLineContainerBBox_; } | ||
svgedit.browser.supportsGoodTextCharPos = function() { return supportsGoodTextCharPos_; } | ||
svgedit.browser.supportsEditableText = function() { return supportsEditableText_; } | ||
svgedit.browser.supportsGoodDecimals = function() { return supportsGoodDecimals_; } | ||
svgedit.browser.supportsNonScalingStroke = function() { return supportsNonScalingStroke_; } | ||
svgedit.browser.supportsNativeTransformLists = function() { return supportsNativeSVGTransformLists_; } | ||
|
||
} | ||
|
||
})(); |
Oops, something went wrong.