paper.js/src/project/Symbol.js

44 lines
959 B
JavaScript
Raw Normal View History

/*
* Paper.js
*
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
* based on Scriptographer.org and designed to be largely API compatible.
* http://paperjs.org/
* http://scriptographer.org/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
* http://lehni.org/ & http://jonathanpuckey.com/
*
* All rights reserved.
*/
var Symbol = this.Symbol = Base.extend({
beans: true,
initialize: function(item) {
this.project = paper.project;
this.project.symbols.push(this);
this.setDefinition(item);
},
clone: function() {
2011-05-20 03:55:44 -04:00
return new Symbol(this._definition.clone());
},
2011-05-20 03:55:44 -04:00
// TODO: remove()
getDefinition: function() {
return this._definition;
},
setDefinition: function(item) {
this._definition = item;
item.selected = false;
item._removeFromParent();
2011-05-20 03:55:44 -04:00
// Move position to 0, 0. TODO: Why?
item.setPosition(new Point());
}
});