Declare all classes as local variables, so they can be scoped.

This commit is contained in:
Jürg Lehni 2011-03-03 13:33:41 +00:00
parent c84df5a346
commit 941c3c7346
24 changed files with 25 additions and 26 deletions

View file

@ -1,4 +1,4 @@
Paper = Base.extend({ var Paper = Base.extend({
statics: { statics: {
documents: [], documents: [],
activateDocument: function(doc) { activateDocument: function(doc) {

View file

@ -1,4 +1,4 @@
Rectangle = Base.extend({ var Rectangle = Base.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
Color = Base.extend({ var Color = Base.extend({
beans: true, beans: true,
/** /**

View file

@ -1,4 +1,4 @@
Gradient = Base.extend({ var Gradient = Base.extend({
initialize: function() { initialize: function() {
this.stops = [new GradientStop('white', 0), new GradientStop('black', 1)]; this.stops = [new GradientStop('white', 0), new GradientStop('black', 1)];
this.type = 'linear'; this.type = 'linear';

View file

@ -1,4 +1,4 @@
GradientColor = Color.extend({ var GradientColor = Color.extend({
beans: true, beans: true,
initialize: function(gradient, origin, destination, hilite) { initialize: function(gradient, origin, destination, hilite) {

View file

@ -1,4 +1,4 @@
GradientStop = Base.extend({ var GradientStop = Base.extend({
beans: true, beans: true,
// TODO: support midPoint? (initial tests didn't look nice) // TODO: support midPoint? (initial tests didn't look nice)

View file

@ -1,4 +1,4 @@
GrayColor = Color.extend({ var GrayColor = Color.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
RGBColor = Color.extend(new function() { var RGBColor = Color.extend(new function() {
// TODO: convert hex codes to [r,g,b]? // TODO: convert hex codes to [r,g,b]?
var namedColors = { var namedColors = {
lightpink: 'FFB6C1', pink: 'FFC0CB', crimson: 'DC143C', lightpink: 'FFB6C1', pink: 'FFC0CB', crimson: 'DC143C',

View file

@ -1,4 +1,4 @@
Doc = Base.extend({ var Doc = Base.extend({
beans: true, beans: true,
initialize: function(canvas) { initialize: function(canvas) {

View file

@ -1,4 +1,4 @@
DocumentView = Base.extend({ var DocumentView = Base.extend({
beans: true, beans: true,
initialize: function(document) { initialize: function(document) {

View file

@ -1,4 +1,4 @@
Symbol = Base.extend({ var Symbol = Base.extend({
beans: true, beans: true,
initialize: function(item) { initialize: function(item) {

View file

@ -1,4 +1,4 @@
Group = Item.extend({ var Group = Item.extend({
beans: true, beans: true,
initialize: function(items) { initialize: function(items) {
this.base(); this.base();

View file

@ -1,4 +1,4 @@
Item = Base.extend({ var Item = Base.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
Layer = Group.extend({ var Layer = Group.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
PathStyle = Base.extend(new function() { var PathStyle = Base.extend(new function() {
var keys = ['windingRule', 'resolution', 'strokeColor', 'strokeWidth', var keys = ['windingRule', 'resolution', 'strokeColor', 'strokeWidth',
'strokeCap', 'strokeJoin', 'dashOffset','dashArray', 'miterLimit', 'strokeCap', 'strokeJoin', 'dashOffset','dashArray', 'miterLimit',
'strokeOverprint', 'fillColor', 'fillOverprint']; 'strokeOverprint', 'fillColor', 'fillOverprint'];

View file

@ -1,4 +1,4 @@
PlacedSymbol = Item.extend({ var PlacedSymbol = Item.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
Raster = Item.extend({ var Raster = Item.extend({
beans: true, beans: true,
// TODO: implement url / type, width, height // TODO: implement url / type, width, height

View file

@ -1,4 +1,4 @@
CompoundPath = PathItem.extend({ var CompoundPath = PathItem.extend({
initialize: function(items) { initialize: function(items) {
this.base(); this.base();
this.children = []; this.children = [];

View file

@ -1,8 +1,7 @@
Curve = Base.extend({ var Curve = Base.extend({
initialize: function() { initialize: function() {
}, },
statics: { statics: {
read: function(args, index, length) { read: function(args, index, length) {
var index = index || 0, length = length || args.length - index; var index = index || 0, length = length || args.length - index;

View file

@ -1,4 +1,4 @@
Path = PathItem.extend({ var Path = PathItem.extend({
beans: true, beans: true,
initialize: function(/* segments */) { initialize: function(/* segments */) {

View file

@ -1,4 +1,4 @@
PathItem = Item.extend({ var PathItem = Item.extend({
beans: true, beans: true,
initialize: function() { initialize: function() {

View file

@ -1,4 +1,4 @@
Segment = Base.extend({ var Segment = Base.extend({
initialize: function() { initialize: function() {
if (arguments.length == 0) { if (arguments.length == 0) {
this.point = new Point(); this.point = new Point();

View file

@ -1,4 +1,4 @@
Tool = ToolHandler.extend(new function() { var Tool = ToolHandler.extend(new function() {
function viewToArtwork(event, document) { function viewToArtwork(event, document) {
var point = Point.create(event.offset.x, event.offset.y); var point = Point.create(event.offset.x, event.offset.y);
// TODO: always the active view? // TODO: always the active view?

View file

@ -1,4 +1,4 @@
ToolHandler = Base.extend({ var ToolHandler = Base.extend({
beans: true, beans: true,
/** /**