Skip to content

Commit d10146f

Browse files
author
_pants
committed
workaround for angular/angular.js#1050
1 parent 708aafd commit d10146f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

app/js/directives.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
angular.module('app.directives', [])
3+
var directives = angular.module('app.directives', [])
44
.directive('updateOnBlur', function() {
55
return {
66
restrict: 'EA',
@@ -14,5 +14,16 @@ angular.module('app.directives', [])
1414
});
1515
}
1616
};
17-
})
18-
;
17+
});
18+
19+
// XXX https://github.com/angular/angular.js/issues/1050#issuecomment-9650293
20+
angular.forEach(['cx', 'cy', 'd', 'fill', 'r'], function(name) {
21+
var ngName = 'ng' + name[0].toUpperCase() + name.slice(1);
22+
directives.directive(ngName, function() {
23+
return function(scope, element, attrs) {
24+
attrs.$observe(ngName, function(value) {
25+
attrs.$set(name, value);
26+
})
27+
};
28+
});
29+
});

app/partials/vis.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
<g id="countries">
33
<g ng-repeat="d in countryGeometries">
44
<title ui-if="d.alpha2">{{ d.alpha2 | i18n }}: {{ model.countries[d.alpha2].npeers.online.giveGet || 0 }} peers online, {{ model.countries[d.alpha2].npeers.online.give || 0 }} in Give Mode, {{ model.countries[d.alpha2].npeers.online.get || 0 }} in Get Mode</title><!-- XXX i18n -->
5-
<path fill="{{ fillByCountry[d.alpha2] || 'rgba(0, 0, 0, 0)' }}" class="{{ d.alpha2 }}" d="{{ countryPaths[d.alpha2] }}"/>
5+
<path ng-fill="{{ fillByCountry[d.alpha2] || 'rgba(0, 0, 0, 0)' }}" class="{{ d.alpha2 }}" ng-d="{{ countryPaths[d.alpha2] }}"/>
66
</g>
77
</g>
88
<g id="peersCurrent">
99
<g ng-repeat="peer in model.connectivity.peers.current">
10-
<path d="M {{ self.x }} {{ self.y }} Q {{ controlpoint(peer).x }} {{ controlpoint(peer).y }} {{ project(peer).x }} {{ project(peer).y }}" class="connection"/>
11-
<circle cx="{{ project(peer).x }}" cy="{{ project(peer).y }}" r="{{ peerR }}"
10+
<path ng-d="M {{ self.x }} {{ self.y }} Q {{ controlpoint(peer).x }} {{ controlpoint(peer).y }} {{ project(peer).x }} {{ project(peer).y }}" class="connection"/>
11+
<circle ng-cx="{{ project(peer).x }}" ng-cy="{{ project(peer).y }}" ng-r="{{ peerR }}"
1212
id="{{ peer.peerid }}" class="peer {{ peer.mode }}" filter="url(#blur)">
1313
<title>{{ peer | prettyUser }}</title>
1414
</circle>
1515
<animate attributeType="CSS" attributeName="opacity" from="0" to="1" dur="3s" repeatCount="1"/>
1616
</g>
1717
</g>
1818
<!-- XXX show last seen locations of peers not connected to -->
19-
<circle id="self" cx="{{ self.x }}" cy="{{ self.y }}" r="{{ selfR }}"
19+
<circle id="self" ng-cx="{{ self.x }}" ng-cy="{{ self.y }}" ng-r="{{ selfR }}"
2020
class="{{ model.settings.mode }}" filter="url(#blur)">
2121
<title>{{ model.profile | prettyUser }}</title>
2222
<!--animate attributeType="CSS" attributeName="opacity" from=".5" to="1" dur="2s" repeatCount="indefinite"/-->

0 commit comments

Comments
 (0)