forked from chemhack/jchemhub
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of git://github.com/novakps/kemia into dev…
…elopment
- Loading branch information
Showing
16 changed files
with
1,372 additions
and
1,194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,64 @@ | ||
goog.provide("kemia.graphics.ElementArray"); | ||
goog.require('goog.array'); | ||
goog.require("goog.debug.Logger"); | ||
|
||
/** | ||
* convenience class to contain group of goog.graphics.Elements since nested vml groups do not seem to work for IE8 in standards mode | ||
* | ||
* @constructor | ||
*/ | ||
kemia.graphics.ElementArray = function() { | ||
/** @type{Array.<goog.graphics.Element>} | ||
* @private | ||
*/ | ||
this._elements = []; | ||
} | ||
|
||
/** | ||
* Logging object. | ||
* | ||
* @type {goog.debug.Logger} | ||
* @protected | ||
*/ | ||
kemia.graphics.ElementArray.prototype.logger = goog.debug.Logger | ||
.getLogger('kemia.graphics.ElementArray'); | ||
|
||
/** | ||
* add a graphics element | ||
* @param {goog.graphics.Element} element the element to add | ||
*/ | ||
kemia.graphics.ElementArray.prototype.add = function(element) { | ||
goog.asserts.assert(element instanceof goog.graphics.Element); | ||
this._elements.push(element); | ||
return this; | ||
} | ||
|
||
/** | ||
* remove all elements | ||
*/ | ||
kemia.graphics.ElementArray.prototype.clear = function() { | ||
goog.array.forEach(this._elements, | ||
function(element) { | ||
element.getGraphics().removeElement(element); | ||
}, | ||
this); | ||
this._elements.length = 0; | ||
} | ||
|
||
/** | ||
* Set the transformation of the elements. | ||
* @param {number} x The x coordinate of the translation transform. | ||
* @param {number} y The y coordinate of the translation transform. | ||
* @param {number} rotate The angle of the rotation transform. | ||
* @param {number} centerX The horizontal center of the rotation transform. | ||
* @param {number} centerY The vertical center of the rotation transform. | ||
*/ | ||
kemia.graphics.ElementArray.prototype.setTransformation = function(x, y, rotate, | ||
centerX, centerY) { | ||
goog.array.forEach(this._elements, | ||
function(element) { | ||
element.setTransformation(x, y, rotate, centerX, centerY); | ||
}); | ||
} | ||
|
||
|
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
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
Oops, something went wrong.