geojs 1.11.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geojs",
3
- "version": "1.11.2",
3
+ "version": "1.12.0",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "optionalDependencies": {
29
29
  "@egjs/hammerjs": "^2.0.8",
30
- "d3": "^3.5.17",
30
+ "d3": "^7.8.5",
31
31
  "glslang-validator-prebuilt-predownloaded": "^0.0.2",
32
32
  "vtk.js": "*"
33
33
  },
@@ -50,11 +50,11 @@
50
50
  "eslint-plugin-import": "^2.25.3",
51
51
  "eslint-plugin-n": "^15.2.4",
52
52
  "eslint-plugin-promise": "^6.0.0",
53
- "expose-loader": "^4.0.0",
53
+ "expose-loader": "^5.0.0",
54
54
  "express": "^4.17.2",
55
55
  "fs-extra": "^11.0.0",
56
56
  "glob": "^10.1.0",
57
- "imports-loader": "^4.0.0",
57
+ "imports-loader": "^5.0.0",
58
58
  "jasmine-core": "^5.0.0",
59
59
  "js-yaml": "^4.1.0",
60
60
  "jsdoc": "^4.0.0",
@@ -83,10 +83,10 @@
83
83
  "shader-loader": "git+https://github.com/Makio64/shader-loader",
84
84
  "sinon": "^17.0.0",
85
85
  "style-loader": "^3.3.1",
86
- "stylelint": "^15.11.0",
87
- "stylelint-stylus": "^0.18.0",
88
- "stylus": "^0.59.0",
89
- "stylus-loader": "^7.0.0",
86
+ "stylelint": "^16.0.0",
87
+ "stylelint-stylus": "^1.0.0",
88
+ "stylus": "^0.62.0",
89
+ "stylus-loader": "^8.0.0",
90
90
  "tar": "^6.1.13",
91
91
  "terser-webpack-plugin": "^5.3.1",
92
92
  "touch-emulator": "^1.0.0",
@@ -9,7 +9,7 @@ var feature = require('./feature');
9
9
  * @property {geo.colorObject[]} [colorRange] Color lookup table. Default is
10
10
  * 9-step color table.
11
11
  * @property {function} [scale] A scale converts a input domain into the
12
- * the colorRange. Default is `d3.scale.quantize()`.
12
+ * the colorRange. Default is `d3.scaleQuantize()`.
13
13
  * @property {function} [geoId] Given a geometry feature, return an identifier.
14
14
  * @property {function} [scalarId] Given a scalar element, return an
15
15
  * identifier.
@@ -59,7 +59,7 @@ var choroplethFeature = function (arg) {
59
59
  {r: 1, g: 0.472800903, b: 0.404551679},
60
60
  {r: 0.916482116, g: 0.236630659, b: 0.209939162}
61
61
  ],
62
- scale: d3.scale.quantize(),
62
+ scale: d3.scaleQuantize(),
63
63
  //accessor for ID on geodata feature
64
64
  geoId: function (geoFeature) {
65
65
  return geoFeature.properties.GEO_ID;
@@ -82,11 +82,11 @@ var svg_lineFeature = function (arg) {
82
82
  }
83
83
  }
84
84
 
85
- line = d3.svg.line()
85
+ line = d3.line()
86
86
  .x(function (d) { return m_this.featureGcsToDisplay(d).x; })
87
87
  .y(function (d) { return m_this.featureGcsToDisplay(d).y; })
88
- .interpolate(m_this.style.get('closed')(item, idx) && ln.length > 2 ?
89
- 'linear-closed' : 'linear');
88
+ .curve(m_this.style.get('closed')(item, idx) && ln.length > 2 ?
89
+ d3.curveLinearClosed : d3.curveLinear);
90
90
  // item is an object representing a single line
91
91
  // m_this.line()(item) is an array of coordinates
92
92
  m_style = {
@@ -19,7 +19,6 @@ var svg_pathFeature = function (arg) {
19
19
  }
20
20
 
21
21
  var $ = require('jquery');
22
- var d3 = require('./svgRenderer').d3;
23
22
  var object = require('./object');
24
23
  var timestamp = require('../timestamp');
25
24
 
@@ -47,11 +46,12 @@ var svg_pathFeature = function (arg) {
47
46
  s_update.call(m_this);
48
47
 
49
48
  diag = function (d) {
50
- var p = {
51
- source: d.source,
52
- target: d.target
53
- };
54
- return d3.svg.diagonal()(p);
49
+ // in d3 v3 this was "d3.svg.diagonal(d);". See
50
+ // https://stackoverflow.com/questions/40845121/where-is-d3-svg-diagonal
51
+ return 'M' + d.source.x + ',' + d.source.y + 'C' +
52
+ d.source.x + ',' + (d.source.y + d.target.y) / 2 + ' ' +
53
+ d.target.x + ',' + (d.source.y + d.target.y) / 2 + ' ' +
54
+ d.target.x + ',' + d.target.y;
55
55
  };
56
56
  tmp = [];
57
57
  data.forEach(function (d, i) {
@@ -591,7 +591,9 @@ var svgRenderer = function (arg) {
591
591
  entries, rendersel;
592
592
  entries = selection.enter().append(append);
593
593
  selection.exit().remove();
594
- rendersel = m_features[id].onlyRenderNew ? entries : selection;
594
+ // in d3 v3 this was
595
+ // rendersel = m_features[id].onlyRenderNew ? entries : selection;
596
+ rendersel = entries;
595
597
  setAttrs(rendersel, attributes);
596
598
  rendersel.attr('class', classes.concat([id]).join(' '));
597
599
  setStyles(rendersel, style);
@@ -143,17 +143,17 @@ var svg_vectorFeature = function (arg) {
143
143
  return markers;
144
144
  }, []);
145
145
 
146
+ markerGroup = m_this.renderer()._definitions()
147
+ .selectAll('g.marker-group#' + m_this._svgid());
148
+
146
149
  var sel = markerGroup
147
150
  .selectAll('marker.geo-vector-marker')
148
151
  .data(markers);
149
152
 
150
- sel.enter()
151
- .append('marker')
152
- .append('path');
153
-
154
153
  var renderer = m_this.renderer();
155
154
 
156
- sel
155
+ sel.enter()
156
+ .append('marker')
157
157
  .each(function (d) {
158
158
  var marker = d3.select(this);
159
159
  var markerData = d.head ? markerConfigs[endStyle(d.data, d.dataIndex)] : markerConfigs[originStyle(d.data, d.dataIndex)];
@@ -173,7 +173,7 @@ var svg_vectorFeature = function (arg) {
173
173
  .style('opacity', function (d) {
174
174
  return opacity(d.data, d.dataIndex);
175
175
  })
176
- .select('path')
176
+ .append('path')
177
177
  .attr('d', function (d) {
178
178
  return d.head ? markerConfigs[endStyle(d.data, d.dataIndex)].path : markerConfigs[originStyle(d.data, d.dataIndex)].path;
179
179
  });
@@ -108,13 +108,10 @@ var colorLegendWidget = function (arg) {
108
108
 
109
109
  var legendSvg = legendContainer
110
110
  .append('svg')
111
- .attr({
112
- class: 'svg',
113
- width: width,
114
- height: '40px',
115
- viewBox: -margin + ' 0 ' + width + ' 40'
116
- });
117
-
111
+ .attr('class', 'svg')
112
+ .attr('width', width)
113
+ .attr('height', '40px')
114
+ .attr('viewBox', -margin + ' 0 ' + width + ' 40');
118
115
  if (category.type === 'discrete') {
119
116
  m_this._drawDiscrete(legendSvg, width - 2 * margin, category);
120
117
  } else if (category.type === 'continuous') {
@@ -190,32 +187,41 @@ var colorLegendWidget = function (arg) {
190
187
  * @param {geo.gui.colorLegendWidget.category} category The discrete type legend category
191
188
  */
192
189
  this._drawDiscrete = function (svg, width, category) {
190
+ /**
191
+ * Render the d3 axis object based on the axis d3 Scale.
192
+ * @param {object} axisScale d3 scale object
193
+ * @returns {object} d3 axis object
194
+ */
195
+ function createAxis(axisScale) {
196
+ var skip = Math.ceil(axisScale.domain().length / m_ticks);
197
+ var values = axisScale.domain().filter(function (d, i) { return i % skip === 0; });
198
+ return d3.axisBottom(axisScale)
199
+ .tickFormat(d3.format('.2s'))
200
+ .tickValues(values);
201
+ }
202
+
193
203
  if (['linear', 'log', 'sqrt', 'pow', 'quantile', 'ordinal'].indexOf(category.scale) === -1) {
194
204
  throw new Error('unsupported scale');
195
205
  }
196
206
  var valueRange, valueScale, colorScale, axisScale, axis, steps, ticks;
197
207
  if (category.scale === 'ordinal') {
198
- colorScale = d3.scale.ordinal()
208
+ colorScale = d3.scaleOrdinal()
199
209
  .domain(category.domain)
200
210
  .range(category.colors);
201
211
  m_this._renderDiscreteColors(
202
212
  svg, category.domain, colorScale, width, function (d) { return d; });
203
213
 
204
- axisScale = d3.scale.ordinal()
214
+ axisScale = d3.scaleBand()
205
215
  .domain(category.domain)
206
- .rangeRoundBands([0, width]);
207
- axis = d3.svg.axis()
208
- .scale(axisScale)
209
- .tickValues(function () {
210
- var skip = Math.ceil(category.domain.length / m_ticks);
211
- return category.domain
212
- .filter(function (d, i) { return i % skip === 0; });
213
- });
216
+ .rangeRound([0, width]);
217
+ var skip = Math.ceil(category.domain.length / m_ticks);
218
+ var values = category.domain.filter(function (d, i) { return i % skip === 0; });
219
+ axis = d3.axisBottom(axisScale).tickValues(values);
214
220
  } else if (category.scale === 'quantile') {
215
221
  valueRange = [0, category.colors.length];
216
222
  steps = util.range(0, category.colors.length - 1);
217
- valueScale = d3.scale.quantile().domain(category.domain).range(steps);
218
- colorScale = d3.scale.quantize().domain(valueRange).range(category.colors);
223
+ valueScale = d3.scaleQuantile().domain(category.domain).range(steps);
224
+ colorScale = d3.scaleQuantize().domain(valueRange).range(category.colors);
219
225
  m_this._renderDiscreteColors(svg, steps, colorScale, width, function (d) {
220
226
  return valueScale.invertExtent(d).join(' - ');
221
227
  });
@@ -224,15 +230,15 @@ var colorLegendWidget = function (arg) {
224
230
  axisDomain = axisDomain.concat(steps.map(
225
231
  function (step) { return valueScale.invertExtent(step)[1]; }));
226
232
 
227
- axisScale = d3.scale.ordinal()
233
+ axisScale = d3.scalePoint()
228
234
  .domain(axisDomain)
229
- .rangePoints([0, width]);
235
+ .range([0, width]);
230
236
  axis = createAxis(axisScale);
231
237
  } else if (['linear', 'log', 'sqrt', 'pow'].indexOf(category.scale) !== -1) {
232
238
  valueRange = [0, category.colors.length];
233
- valueScale = d3.scale[category.scale]()
239
+ valueScale = d3['scale' + category.scale.charAt(0).toUpperCase() + category.scale.slice(1)]()
234
240
  .domain(category.domain).range(valueRange).nice();
235
- colorScale = d3.scale.quantize().domain(valueRange).range(category.colors);
241
+ colorScale = d3.scaleQuantize().domain(valueRange).range(category.colors);
236
242
  steps = util.range(0, category.colors.length - 1);
237
243
  var precision = Math.max.apply(null, category.domain
238
244
  .map(function (number) { return getPrecision(number); }));
@@ -243,32 +249,17 @@ var colorLegendWidget = function (arg) {
243
249
 
244
250
  ticks = steps.slice();
245
251
  ticks.push(category.colors.length);
246
- axisScale = d3.scale.ordinal()
252
+ axisScale = d3.scalePoint()
247
253
  .domain(ticks.map(function (tick) {
248
254
  return valueScale.invert(tick);
249
255
  }))
250
- .rangePoints([0, width]);
256
+ .range([0, width]);
251
257
  axis = createAxis(axisScale);
252
258
  }
253
259
  if (category.endAxisLabelOnly) {
254
260
  axis.tickValues([axisScale.domain()[0], axisScale.domain()[axisScale.domain().length - 1]]);
255
261
  }
256
262
  m_this._renderAxis(svg, axis);
257
-
258
- /**
259
- * Render the d3 axis object based on the axis d3 Scale.
260
- * @param {object} axisScale d3 scale object
261
- * @returns {object} d3 axis object
262
- */
263
- function createAxis(axisScale) {
264
- return d3.svg.axis()
265
- .scale(axisScale)
266
- .tickFormat(d3.format('.2s'))
267
- .tickValues(function () {
268
- var skip = Math.ceil(axisScale.domain().length / m_ticks);
269
- return axisScale.domain().filter(function (d, i) { return i % skip === 0; });
270
- });
271
- }
272
263
  };
273
264
 
274
265
  /**
@@ -292,8 +283,8 @@ var colorLegendWidget = function (arg) {
292
283
  .attr('transform', function (d, i) {
293
284
  return 'translate(' + i * width / steps.length + ' ,0)';
294
285
  })
295
- .on('mousemove', function (d) {
296
- m_this._showPopup(getValue(d));
286
+ .on('mousemove', function (evt, d) {
287
+ m_this._showPopup(evt, getValue(d));
297
288
  })
298
289
  .on('mouseout', m_this._hidePopup);
299
290
  };
@@ -314,7 +305,7 @@ var colorLegendWidget = function (arg) {
314
305
  range.push((width / (category.domain.length - 1) * i));
315
306
  }
316
307
  range.push(width);
317
- axisScale = d3.scale[category.scale]().domain(category.domain).range(range).nice();
308
+ axisScale = d3['scale' + category.scale.charAt(0).toUpperCase() + category.scale.slice(1)]().domain(category.domain).range(range).nice();
318
309
  if (category.scale === 'log' && category.base) {
319
310
  axisScale.base(category.base);
320
311
  }
@@ -344,15 +335,14 @@ var colorLegendWidget = function (arg) {
344
335
  .attr('fill', 'url(#gradient' + id + ')')
345
336
  .attr('width', width)
346
337
  .attr('height', '20px')
347
- .on('mousemove', function () {
348
- var value = axisScale.invert(d3.mouse(this)[0]);
338
+ .on('mousemove', function (event) {
339
+ var value = axisScale.invert(d3.pointer(event)[0]);
349
340
  var text = m_this._popupFormatter(value, precision);
350
- m_this._showPopup(text);
341
+ m_this._showPopup(event, text);
351
342
  })
352
343
  .on('mouseout', m_this._hidePopup);
353
344
 
354
- axis = d3.svg.axis()
355
- .scale(axisScale)
345
+ axis = d3.axisBottom(axisScale)
356
346
  .ticks(m_ticks, '.2s');
357
347
  if (category.endAxisLabelOnly) {
358
348
  axis.tickValues([category.domain[0], category.domain[category.domain.length - 1]]);
@@ -369,9 +359,12 @@ var colorLegendWidget = function (arg) {
369
359
  svg.append('g')
370
360
  .attr('class', 'axis x')
371
361
  .attr('transform', 'translate(0, 20)')
362
+ /*
372
363
  .call(function (g) {
373
364
  g.call(axis);
374
365
  });
366
+ */
367
+ .call(axis);
375
368
  };
376
369
 
377
370
  /**
@@ -390,22 +383,20 @@ var colorLegendWidget = function (arg) {
390
383
 
391
384
  /**
392
385
  * Show the popup based on current mouse event.
386
+ * @param {d3.event} event The triggering d3 event.
393
387
  * @param {string} text content to be shown in the popup
394
388
  */
395
- this._showPopup = function (text) {
389
+ this._showPopup = function (event, text) {
396
390
  // The cursor location relative to the container
397
- var offset = d3.mouse(m_this.canvas());
391
+ var offset = d3.pointer(event, m_this.canvas());
398
392
  m_this.popup
399
393
  .text(text);
400
394
  var containerWidth = m_this.canvas().clientWidth;
401
- var popupWidth = m_this.popup[0][0].clientWidth;
395
+ var popupWidth = m_this.popup.node().clientWidth;
402
396
  m_this.popup
403
- .style({
404
- // If the popup will be longer or almost longer than the container
405
- left: offset[0] - (offset[0] +
406
- popupWidth - containerWidth > -10 ? popupWidth : 0) + 'px',
407
- top: (offset[1] - 22) + 'px'
408
- })
397
+ // If the popup will be longer or almost longer than the container
398
+ .style('left', offset[0] - (offset[0] + popupWidth - containerWidth > -10 ? popupWidth : 0) + 'px')
399
+ .style('top', (offset[1] - 22) + 'px')
409
400
  .transition()
410
401
  .duration(200)
411
402
  .style('opacity', 1);
@@ -206,10 +206,10 @@ var legendWidget = function (arg) {
206
206
  */
207
207
  this._scale = function () {
208
208
  return {
209
- x: d3.scale.linear()
209
+ x: d3.scaleLinear()
210
210
  .domain([0, 1])
211
211
  .range([0, m_this.size().width]),
212
- y: d3.scale.linear()
212
+ y: d3.scaleLinear()
213
213
  .domain([0, m_categories.length - 1])
214
214
  .range([m_padding / 2, m_this.size().height - m_padding / 2])
215
215
  };
@@ -249,16 +249,15 @@ var legendWidget = function (arg) {
249
249
  .attr('width', w - 4)
250
250
  .attr('height', h - 4)
251
251
  .attr('rx', 3)
252
- .attr('ry', 3)
253
- .style({
254
- stroke: 'black',
255
- 'stroke-width': '1.5px',
256
- fill: 'white',
257
- 'fill-opacity': 0.75,
258
- display: 'none'
259
- });
260
- m_group.on('mousedown', function () {
261
- d3.event.stopPropagation();
252
+ .attr('ry', 3);
253
+ m_border
254
+ .style('stroke', 'black')
255
+ .style('stroke-width', '1.5px')
256
+ .style('fill', 'white')
257
+ .style('fill-opacity', 0.75)
258
+ .style('display', 'none');
259
+ m_group.on('mousedown', function (evt) {
260
+ evt.stopPropagation();
262
261
  });
263
262
  m_group.on('mouseover', function () {
264
263
  m_border.transition()
@@ -123,10 +123,7 @@ var scaleWidget = function (arg) {
123
123
  m_this._appendCanvasToParent();
124
124
  m_this.reposition();
125
125
 
126
- d3.select(m_this.canvas()).attr({
127
- width: m_options.maxWidth,
128
- height: m_options.maxHeight
129
- });
126
+ d3.select(m_this.canvas()).attr('width', m_options.maxWidth).attr('height', m_options.maxHeight);
130
127
  // Update the scale on pan
131
128
  m_this.geoOn(geo_event.pan, m_this._update);
132
129
  m_this._render();
@@ -220,8 +217,7 @@ var scaleWidget = function (arg) {
220
217
  pixels = (vert ? m_options.maxHeight : m_options.maxWidth) - sw;
221
218
  /* Calculate the distance that the maximum length scale bar can occupy at
222
219
  * the location that the scale bar will be drawn. */
223
- // svg.attr({width: width, height: height});
224
- pt1 = $(svg[0][0]).offset();
220
+ pt1 = $(svg.node()).offset();
225
221
  pt1 = {
226
222
  x: pt1.left + (m_options.orientation === 'left' ? width - sw2 : sw2),
227
223
  y: pt1.top + (m_options.orientation === 'top' ? height - sw2 : sw2)
@@ -238,12 +234,9 @@ var scaleWidget = function (arg) {
238
234
  } else {
239
235
  width = value.pixels + sw;
240
236
  }
241
- svg.attr({width: width, height: height});
237
+ svg.attr('width', width).attr('height', height);
242
238
  if (svg.select('polyline').empty()) {
243
- svg.append('polyline').classed('geojs-scale-widget-bar', true).attr({
244
- fill: 'none',
245
- 'stroke-width': sw
246
- });
239
+ svg.append('polyline').classed('geojs-scale-widget-bar', true).attr('fill', 'none').attr('stroke-width', sw);
247
240
  }
248
241
  if (svg.select('text').empty()) {
249
242
  svg.append('text').classed('geojs-scale-widget-text', true);
@@ -251,39 +244,35 @@ var scaleWidget = function (arg) {
251
244
  switch (m_options.orientation) {
252
245
  case 'bottom':
253
246
  pts = [[sw2, tl], [sw2, sw2], [width - sw2, sw2], [width - sw2, tl]];
254
- svg.select('text').attr({
255
- x: width / 2,
256
- y: sw * 2,
257
- 'text-anchor': 'middle',
258
- 'dominant-baseline': 'hanging'
259
- });
247
+ svg.select('text')
248
+ .attr('x', width / 2)
249
+ .attr('y', sw * 2)
250
+ .attr('text-anchor', 'middle')
251
+ .attr('dominant-baseline', 'hanging');
260
252
  break;
261
253
  case 'top':
262
254
  pts = [[sw2, height - tl], [sw2, height - sw2], [width - sw2, height - sw2], [width - sw2, height - tl]];
263
- svg.select('text').attr({
264
- x: width / 2,
265
- y: height - sw * 2,
266
- 'text-anchor': 'middle',
267
- 'dominant-baseline': 'alphabetic'
268
- });
255
+ svg.select('text')
256
+ .attr('x', width / 2)
257
+ .attr('y', height - sw * 2)
258
+ .attr('text-anchor', 'middle')
259
+ .attr('dominant-baseline', 'alphabetic');
269
260
  break;
270
261
  case 'left':
271
262
  pts = [[width - tl, sw2], [width - sw2, sw2], [width - sw2, height - sw2], [width - tl, height - sw2]];
272
- svg.select('text').attr({
273
- x: width - sw * 2,
274
- y: height / 2,
275
- 'text-anchor': 'end',
276
- 'dominant-baseline': 'middle'
277
- });
263
+ svg.select('text')
264
+ .attr('x', width - sw * 2)
265
+ .attr('y', height / 2)
266
+ .attr('text-anchor', 'end')
267
+ .attr('dominant-baseline', 'middle');
278
268
  break;
279
269
  case 'right':
280
270
  pts = [[tl, sw2], [sw2, sw2], [sw2, height - sw2], [tl, height - sw2]];
281
- svg.select('text').attr({
282
- x: sw * 2,
283
- y: height / 2,
284
- 'text-anchor': 'start',
285
- 'dominant-baseline': 'middle'
286
- });
271
+ svg.select('text')
272
+ .attr('x', sw * 2)
273
+ .attr('y', height / 2)
274
+ .attr('text-anchor', 'start')
275
+ .attr('dominant-baseline', 'middle');
287
276
  break;
288
277
  }
289
278
  svg.select('polyline').attr('points', pts.map(function (pt) { return pt.join(','); }).join(' '));
@@ -112,8 +112,8 @@ var sliderWidget = function (arg) {
112
112
 
113
113
  // create d3 scales for positioning
114
114
  // TODO: make customizable and responsive
115
- m_xscale = d3.scale.linear().domain([-4, 4]).range([0, m_width]);
116
- m_yscale = d3.scale.linear().domain([0, 1]).range([m_width * 1.5, m_height - m_width * 1.5]);
115
+ m_xscale = d3.scaleLinear().domain([-4, 4]).range([0, m_width]);
116
+ m_yscale = d3.scaleLinear().domain([0, 1]).range([m_width * 1.5, m_height - m_width * 1.5]);
117
117
 
118
118
  // Create the main group element
119
119
  svg = svg.append('g').classed('geo-ui-slider', true);
@@ -130,19 +130,17 @@ var sliderWidget = function (arg) {
130
130
  .attr('cx', m_xscale(0))
131
131
  .attr('cy', m_yscale(0.0) - m_width + 2)
132
132
  .attr('r', (m_width - 2) / 2)
133
- .style({
134
- cursor: 'pointer'
135
- })
133
+ .style('cursor', 'pointer')
136
134
  .on('click', function () {
137
135
  var z = map.zoom();
138
136
  map.transition({
139
137
  zoom: z + 1,
140
- ease: d3.ease('cubic-in-out'),
138
+ ease: d3.easeCubicInOut,
141
139
  duration: 500
142
140
  });
143
141
  })
144
- .on('mousedown', function () {
145
- d3.event.stopPropagation();
142
+ .on('mousedown', function (evt) {
143
+ evt.stopPropagation();
146
144
  });
147
145
 
148
146
  put_icon(
@@ -170,19 +168,17 @@ var sliderWidget = function (arg) {
170
168
  .attr('cx', m_xscale(0))
171
169
  .attr('cy', m_yscale(1.0) + m_width - 2)
172
170
  .attr('r', (m_width - 2) / 2)
173
- .style({
174
- cursor: 'pointer'
175
- })
171
+ .style('cursor', 'pointer')
176
172
  .on('click', function () {
177
173
  var z = map.zoom();
178
174
  map.transition({
179
175
  zoom: z - 1,
180
- ease: d3.ease('cubic-in-out'),
176
+ ease: d3.easeCubicInOut,
181
177
  duration: 500
182
178
  });
183
179
  })
184
- .on('mousedown', function () {
185
- d3.event.stopPropagation();
180
+ .on('mousedown', function (evt) {
181
+ evt.stopPropagation();
186
182
  });
187
183
 
188
184
  put_icon(
@@ -206,13 +202,13 @@ var sliderWidget = function (arg) {
206
202
  * @param {boolean} [trans] Truthy for an animated transition.
207
203
  */
208
204
  function respond(evt, trans) {
209
- var z = m_yscale.invert(d3.mouse(svg.node())[1]),
205
+ var z = m_yscale.invert(d3.pointer(event, svg.node())[1]),
210
206
  zrange = map.zoomRange();
211
207
  z = (1 - z) * (zrange.max - zrange.min) + zrange.min;
212
208
  if (trans) {
213
209
  map.transition({
214
210
  zoom: z,
215
- ease: d3.ease('cubic-in-out'),
211
+ ease: d3.easeCubicInOut,
216
212
  duration: 500,
217
213
  done: m_this._update()
218
214
  });
@@ -236,11 +232,9 @@ var sliderWidget = function (arg) {
236
232
  .attr('ry', m_width / 10)
237
233
  .attr('width', m_width / 3)
238
234
  .attr('height', m_height - m_width * 3)
239
- .style({
240
- cursor: 'pointer'
241
- })
242
- .on('click', function () {
243
- respond(d3.event, true);
235
+ .style('cursor', 'pointer')
236
+ .on('click', function (evt) {
237
+ respond(evt, true);
244
238
  });
245
239
 
246
240
  // Create the nub
@@ -256,18 +250,16 @@ var sliderWidget = function (arg) {
256
250
  .attr('ry', 3)
257
251
  .attr('width', m_width)
258
252
  .attr('height', m_nubSize)
259
- .style({
260
- cursor: 'pointer'
261
- })
262
- .on('mousedown', function () {
253
+ .style('cursor', 'pointer')
254
+ .on('mousedown', function (evt) {
263
255
  d3.select(document).on('mousemove.geo.slider', function () {
264
- respond(d3.event);
256
+ respond(evt);
265
257
  });
266
258
  d3.select(document).on('mouseup.geo.slider', function () {
267
- respond(d3.event);
259
+ respond(evt);
268
260
  d3.select(document).on('.geo.slider', null);
269
261
  });
270
- d3.event.stopPropagation();
262
+ evt.stopPropagation();
271
263
  });
272
264
 
273
265
  /**
@@ -332,7 +324,7 @@ var sliderWidget = function (arg) {
332
324
  var map = m_this.layer().map(),
333
325
  zoomRange = map.zoomRange(),
334
326
  zoom = map.zoom(),
335
- zoomScale = d3.scale.linear();
327
+ zoomScale = d3.scaleLinear();
336
328
 
337
329
  obj = obj || {};
338
330
  zoom = obj.value || zoom;
@@ -89,7 +89,7 @@ var svgWidget = function (arg) {
89
89
  // svg widgets manage their own sizes, so make the resize handler a no-op
90
90
  m_renderer._resize = function () {};
91
91
 
92
- m_this.canvas(m_renderer.canvas()[0][0]);
92
+ m_this.canvas(m_renderer.canvas().node());
93
93
  };
94
94
 
95
95
  return this;
package/src/vendor.js CHANGED
@@ -1,12 +1,4 @@
1
- // License headers that will be preserved in distributed bundles.
2
- /*
3
- * d3
4
- * @copyright 2010-2016, Michael Bostock
5
- * @license BSD-3-Clause
6
- */
7
-
8
1
  var globals = {
9
- d3: require('d3'),
10
2
  hammerjs: require('hammerjs')
11
3
  };
12
4