mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Declare all classes as local variables, so they can be scoped.
This commit is contained in:
parent
c84df5a346
commit
941c3c7346
24 changed files with 25 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
||||||
Paper = Base.extend({
|
var Paper = Base.extend({
|
||||||
statics: {
|
statics: {
|
||||||
documents: [],
|
documents: [],
|
||||||
activateDocument: function(doc) {
|
activateDocument: function(doc) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Rectangle = Base.extend({
|
var Rectangle = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Color = Base.extend({
|
var Color = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
GrayColor = Color.extend({
|
var GrayColor = Color.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Doc = Base.extend({
|
var Doc = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function(canvas) {
|
initialize: function(canvas) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
DocumentView = Base.extend({
|
var DocumentView = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function(document) {
|
initialize: function(document) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Symbol = Base.extend({
|
var Symbol = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function(item) {
|
initialize: function(item) {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Item = Base.extend({
|
var Item = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Layer = Group.extend({
|
var Layer = Group.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -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'];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
PlacedSymbol = Item.extend({
|
var PlacedSymbol = Item.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 = [];
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Path = PathItem.extend({
|
var Path = PathItem.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function(/* segments */) {
|
initialize: function(/* segments */) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
PathItem = Item.extend({
|
var PathItem = Item.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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?
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
ToolHandler = Base.extend({
|
var ToolHandler = Base.extend({
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue