MCPcopy Index your code
hub / github.com/bqplot/bqplot / draw

Method draw

js/src/Map.ts:73–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71 }
72
73 draw() {
74 this.set_ranges();
75 this.remove_map();
76 this.transformed_g = this.map
77 .append('g')
78 .attr('class', 'world_map map' + this.map_id);
79 this.fill_g = this.transformed_g.append('g');
80 this.highlight_g = this.transformed_g.append('g');
81 this.stroke_g = this.transformed_g.append('g');
82 const projection = this.scales.projection;
83 //Bind data and create one path per GeoJSON feature
84 this.fill_g
85 .selectAll('path')
86 .data(this.model.geodata)
87 .enter()
88 .append('path')
89 .attr('d', projection.path)
90 .style('fill', (d, i) => {
91 return this.fill_g_colorfill(d, i);
92 });
93 this.stroke_g
94 .selectAll('path')
95 .data(this.model.geodata)
96 .enter()
97 .append('path')
98 .attr('class', 'event_layer')
99 .attr('d', projection.path)
100 .style('fill-opacity', 0.0)
101 .on('click', (d, i) => {
102 return this.event_dispatcher('element_clicked', { data: d, index: i });
103 });
104 if (this.validate_color(this.model.get('stroke_color'))) {
105 this.stroke_g
106 .selectAll('path')
107 .style('stroke', this.model.get('stroke_color'));
108 }
109 this.zoom = d3
110 .zoom()
111 .scaleExtent([1, 8])
112 .on('zoom', () => {
113 this.zoomed(this);
114 });
115 this.parent.bg_events.call(this.zoom);
116
117 this.parent.bg_events.on('dblclick.zoom', null);
118 this.parent.bg_events.on('dblclick', () => {
119 this.reset_zoom(this);
120 });
121 }
122
123 validate_color(color) {
124 return color !== '';

Callers 4

renderMethod · 0.95
set_positional_scalesMethod · 0.95
renderFunction · 0.45
create_listenersFunction · 0.45

Calls 6

set_rangesMethod · 0.95
remove_mapMethod · 0.95
fill_g_colorfillMethod · 0.95
validate_colorMethod · 0.95
zoomedMethod · 0.95
reset_zoomMethod · 0.95

Tested by

no test coverage detected