summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-02-27 14:09:40 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-02-27 14:09:40 +0100
commit694d054f6aaf421ef563fa006dccbab1bc008a19 (patch)
tree32c357a4c34248e6d51e1516b1683d73deeee51e /objects.js
parenteee7f0b82dfbab26e598401c5c32e74608e9c787 (diff)
downloadsnap-yow-694d054f6aaf421ef563fa006dccbab1bc008a19.tar.gz
snap-yow-694d054f6aaf421ef563fa006dccbab1bc008a19.zip
support rotationStyle
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/objects.js b/objects.js
index 6659225..c29fad5 100644
--- a/objects.js
+++ b/objects.js
@@ -1391,6 +1391,7 @@ SpriteMorph.prototype.init = function (globals) {
};
SpriteMorph.prototype.updateMarker = function () {
+ var facing; // actual costume heading based on my rotation style
// sadly, the name can not be changed on the fly, so the element has to be recreated
// TODO: XSS? Extend L.Icon?
if (!this.marker) return;
@@ -1402,7 +1403,17 @@ SpriteMorph.prototype.updateMarker = function () {
iconAnchor: [this.rotationOffset.x, this.rotationOffset.y]
});
this.marker = L.spriteMarker(this.geoposition, {icon: this.icon, title: this.name});
- this.marker.setAngle(this.heading - 90);
+
+ facing = this.rotationStyle ? this.heading : 90;
+ if (this.rotationStyle === 2) {
+ facing = 90;
+ if ((this.heading > 180 && (this.heading < 360))
+ || (this.heading < 0 && (this.heading > -180))) {
+ facing = -90;
+ }
+ }
+ this.marker.setAngle(facing - 90);
+
this.marker.addTo(window.spriteGroup);
document.getElementById('icon-' + this.name).appendChild(this.costume.contents);
};