diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 14:09:40 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 14:09:40 +0100 |
| commit | 694d054f6aaf421ef563fa006dccbab1bc008a19 (patch) | |
| tree | 32c357a4c34248e6d51e1516b1683d73deeee51e /objects.js | |
| parent | eee7f0b82dfbab26e598401c5c32e74608e9c787 (diff) | |
| download | snap-yow-694d054f6aaf421ef563fa006dccbab1bc008a19.tar.gz snap-yow-694d054f6aaf421ef563fa006dccbab1bc008a19.zip | |
support rotationStyle
Diffstat (limited to 'objects.js')
| -rw-r--r-- | objects.js | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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); }; |
