Skip to content

Commit baf91ad

Browse files
committed
Merge pull-request #27
2 parents 3697e0f + 299f175 commit baf91ad

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/room.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,25 @@ export class SpatialRoom extends EventTarget {
204204
}
205205
}
206206

207+
// Draw points of interest, which are hidden text labels only.
208+
// Note: these are drawn first so they are under the listener possition.
209+
let pois = self.svg.selectAll("text.poi").data(self.data.pointsOfInterest)
210+
pois.enter().append("text")
211+
.attr("text-anchor", "middle")
212+
.attr("class", "poi")
213+
.text(function(d) {
214+
return d.name
215+
})
216+
.merge(pois)
217+
.attr("x", function(d) {
218+
return self.scaleX(
219+
d.location.x + self.data.dimensions.width / 2)
220+
})
221+
.attr("y", function(d) {
222+
return self.scaleY(
223+
self.data.dimensions.depth/2-d.location.z)
224+
})
225+
207226
// Add listener position indicator
208227
let loc = self.svg.selectAll('circle.listener').data([{
209228
x: self.listenerPosition.toSVG().x,
@@ -242,10 +261,16 @@ export class SpatialRoom extends EventTarget {
242261
.attr("text-anchor", "middle")
243262
.attr("class", "sourceText")
244263
.attr("fill", "grey")
245-
.text(function(d) { return d.name })
264+
.text(function(d) {
265+
return d.name
266+
})
246267
.merge(labels)
247-
.attr("x", function(d) { return self.scaleX(d.location.x + self.data.dimensions.width/2) })
248-
.attr("y", function(d) { return self.scaleY(self.data.dimensions.depth/2-d.location.z) })
268+
.attr("x", function(d) {
269+
return self.scaleX(d.location.x + self.data.dimensions.width/2)
270+
})
271+
.attr("y", function(d) {
272+
return self.scaleY(self.data.dimensions.depth/2-d.location.z)
273+
})
249274
.attr("dy", "2em")
250275

251276
this.dispatchEvent(new Event("redraw"))

0 commit comments

Comments
 (0)