@holoviz/geoviews 1.12.0-a.2 → 1.12.0-rc.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/dist/geoviews.js +171 -128
- package/dist/geoviews.js.map +1 -1
- package/dist/geoviews.json +1 -1
- package/dist/geoviews.min.js +11 -10
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/models/checkpoint_tool.d.ts +2 -1
- package/dist/lib/models/checkpoint_tool.js +16 -18
- package/dist/lib/models/checkpoint_tool.js.map +1 -1
- package/dist/lib/models/clear_tool.d.ts +2 -1
- package/dist/lib/models/clear_tool.js +13 -19
- package/dist/lib/models/clear_tool.js.map +1 -1
- package/dist/lib/models/index.d.ts +1 -0
- package/dist/lib/models/poly_draw.d.ts +9 -7
- package/dist/lib/models/poly_draw.js +88 -64
- package/dist/lib/models/poly_draw.js.map +1 -1
- package/dist/lib/models/poly_edit.d.ts +13 -9
- package/dist/lib/models/poly_edit.js +71 -52
- package/dist/lib/models/poly_edit.js.map +1 -1
- package/dist/lib/models/restore_tool.d.ts +2 -1
- package/dist/lib/models/restore_tool.js +14 -15
- package/dist/lib/models/restore_tool.js.map +1 -1
- package/package.json +10 -3
package/dist/geoviews.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
/*!
|
|
2
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) Anaconda, Inc., and Bokeh Contributors
|
|
3
4
|
* All rights reserved.
|
|
4
5
|
*
|
|
5
6
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
@@ -33,11 +34,11 @@
|
|
|
33
34
|
})(this, function(Bokeh, version) {
|
|
34
35
|
let define;
|
|
35
36
|
return (function(modules, entry, aliases, externals) {
|
|
36
|
-
const bokeh = typeof Bokeh !== "undefined"
|
|
37
|
+
const bokeh = typeof Bokeh !== "undefined" ? (version != null ? Bokeh[version] : Bokeh) : null;
|
|
37
38
|
if (bokeh != null) {
|
|
38
39
|
return bokeh.register_plugin(modules, entry, aliases);
|
|
39
40
|
} else {
|
|
40
|
-
throw new Error("Cannot find Bokeh " + version + ". You have to load it prior to loading plugins.");
|
|
41
|
+
throw new Error("Cannot find Bokeh" + (version != null ? " " + version : "") + ". You have to load it prior to loading plugins.");
|
|
41
42
|
}
|
|
42
43
|
})
|
|
43
44
|
({
|
|
@@ -51,20 +52,21 @@
|
|
|
51
52
|
},
|
|
52
53
|
"b4555bea44": /* models/index.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
53
54
|
__esModule();
|
|
54
|
-
var checkpoint_tool_1 = require("
|
|
55
|
+
var checkpoint_tool_1 = require("443ddb828d") /* ./checkpoint_tool */;
|
|
55
56
|
__esExport("CheckpointTool", checkpoint_tool_1.CheckpointTool);
|
|
56
|
-
var clear_tool_1 = require("
|
|
57
|
+
var clear_tool_1 = require("2942ff039e") /* ./clear_tool */;
|
|
57
58
|
__esExport("ClearTool", clear_tool_1.ClearTool);
|
|
58
|
-
var poly_draw_1 = require("
|
|
59
|
+
var poly_draw_1 = require("3557d74ee0") /* ./poly_draw */;
|
|
59
60
|
__esExport("PolyVertexDrawTool", poly_draw_1.PolyVertexDrawTool);
|
|
60
|
-
var poly_edit_1 = require("
|
|
61
|
+
var poly_edit_1 = require("238deef1f5") /* ./poly_edit */;
|
|
61
62
|
__esExport("PolyVertexEditTool", poly_edit_1.PolyVertexEditTool);
|
|
62
|
-
var restore_tool_1 = require("
|
|
63
|
+
var restore_tool_1 = require("7d18037934") /* ./restore_tool */;
|
|
63
64
|
__esExport("RestoreTool", restore_tool_1.RestoreTool);
|
|
64
65
|
},
|
|
65
|
-
"
|
|
66
|
-
__esModule();
|
|
66
|
+
"443ddb828d": /* models/checkpoint_tool.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
67
67
|
var _a;
|
|
68
|
+
__esModule();
|
|
69
|
+
const object_1 = require("@bokehjs/core/util/object");
|
|
68
70
|
const array_1 = require("@bokehjs/core/util/array");
|
|
69
71
|
const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
|
|
70
72
|
const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
|
|
@@ -73,15 +75,14 @@
|
|
|
73
75
|
doit() {
|
|
74
76
|
const sources = this.model.sources;
|
|
75
77
|
for (const source of sources) {
|
|
76
|
-
if (
|
|
78
|
+
if (source.buffer == null) {
|
|
77
79
|
source.buffer = [];
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
for (const key
|
|
81
|
-
const column = source.data[key];
|
|
81
|
+
const data_copy = {};
|
|
82
|
+
for (const [key, column] of (0, object_1.entries)(source.data)) {
|
|
82
83
|
const new_column = [];
|
|
83
84
|
for (const arr of column) {
|
|
84
|
-
if (Array.isArray(arr) ||
|
|
85
|
+
if (Array.isArray(arr) || ArrayBuffer.isView(arr)) {
|
|
85
86
|
new_column.push((0, array_1.copy)(arr));
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
@@ -114,20 +115,16 @@
|
|
|
114
115
|
}));
|
|
115
116
|
})();
|
|
116
117
|
},
|
|
117
|
-
"
|
|
118
|
-
__esModule();
|
|
118
|
+
"2942ff039e": /* models/clear_tool.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
119
119
|
var _a;
|
|
120
|
+
__esModule();
|
|
120
121
|
const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
|
|
121
122
|
const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
|
|
122
123
|
const icons_css_1 = require("@bokehjs/styles/icons.css");
|
|
123
124
|
class ClearToolView extends action_tool_1.ActionToolView {
|
|
124
125
|
doit() {
|
|
125
|
-
for (
|
|
126
|
-
|
|
127
|
-
source.data[column] = [];
|
|
128
|
-
}
|
|
129
|
-
source.change.emit();
|
|
130
|
-
source.properties.data.change.emit();
|
|
126
|
+
for (const source of this.model.sources) {
|
|
127
|
+
source.clear();
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
130
|
}
|
|
@@ -151,16 +148,17 @@
|
|
|
151
148
|
}));
|
|
152
149
|
})();
|
|
153
150
|
},
|
|
154
|
-
"
|
|
155
|
-
__esModule();
|
|
151
|
+
"3557d74ee0": /* models/poly_draw.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
156
152
|
var _a;
|
|
153
|
+
__esModule();
|
|
154
|
+
const vectorization_1 = require("@bokehjs/core/vectorization");
|
|
157
155
|
const object_1 = require("@bokehjs/core/util/object");
|
|
158
156
|
const types_1 = require("@bokehjs/core/util/types");
|
|
157
|
+
const assert_1 = require("@bokehjs/core/util/assert");
|
|
159
158
|
const poly_draw_tool_1 = require("@bokehjs/models/tools/edit/poly_draw_tool");
|
|
160
159
|
class PolyVertexDrawToolView extends poly_draw_tool_1.PolyDrawToolView {
|
|
161
160
|
_split_path(x, y) {
|
|
162
|
-
for (
|
|
163
|
-
const renderer = this.model.renderers[r];
|
|
161
|
+
for (const renderer of this.model.renderers) {
|
|
164
162
|
const glyph = renderer.glyph;
|
|
165
163
|
const cds = renderer.data_source;
|
|
166
164
|
const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];
|
|
@@ -184,8 +182,9 @@
|
|
|
184
182
|
xs.splice(i + 1);
|
|
185
183
|
ys.splice(i + 1);
|
|
186
184
|
for (const column of cds.columns()) {
|
|
187
|
-
if ((column !== xkey) && (column != ykey))
|
|
185
|
+
if ((column !== xkey) && (column != ykey)) {
|
|
188
186
|
cds.data[column].splice(index + 1, 0, cds.data[column][index]);
|
|
187
|
+
}
|
|
189
188
|
}
|
|
190
189
|
return;
|
|
191
190
|
}
|
|
@@ -194,55 +193,65 @@
|
|
|
194
193
|
}
|
|
195
194
|
}
|
|
196
195
|
_snap_to_vertex(ev, x, y) {
|
|
197
|
-
|
|
196
|
+
const { vertex_renderer } = this.model;
|
|
197
|
+
if (vertex_renderer != null) {
|
|
198
198
|
// If an existing vertex is hit snap to it
|
|
199
|
-
const vertex_selected = this._select_event(ev, "replace", [
|
|
200
|
-
const point_ds =
|
|
199
|
+
const vertex_selected = this._select_event(ev, "replace", [vertex_renderer]);
|
|
200
|
+
const point_ds = vertex_renderer.data_source;
|
|
201
201
|
// Type once dataspecs are typed
|
|
202
|
-
const point_glyph =
|
|
202
|
+
const point_glyph = vertex_renderer.glyph;
|
|
203
203
|
const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];
|
|
204
|
-
if (vertex_selected.length) {
|
|
204
|
+
if (vertex_selected.length > 0) {
|
|
205
205
|
// If existing vertex is hit split path at that location
|
|
206
206
|
// converting to feature vertex
|
|
207
207
|
const index = point_ds.selected.indices[0];
|
|
208
|
-
if (pxkey)
|
|
209
|
-
x = point_ds.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
if (pxkey) {
|
|
209
|
+
x = point_ds.get(pxkey)[index];
|
|
210
|
+
}
|
|
211
|
+
if (pykey) {
|
|
212
|
+
y = point_ds.get(pykey)[index];
|
|
213
|
+
}
|
|
214
|
+
if (ev.type != "move") {
|
|
213
215
|
this._split_path(x, y);
|
|
216
|
+
}
|
|
214
217
|
point_ds.selection_manager.clear();
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
return [x, y];
|
|
218
221
|
}
|
|
219
222
|
_set_vertices(xs, ys, styles) {
|
|
220
|
-
|
|
223
|
+
const { vertex_renderer } = this.model;
|
|
224
|
+
if (vertex_renderer == null) {
|
|
221
225
|
return;
|
|
222
|
-
|
|
223
|
-
const
|
|
226
|
+
}
|
|
227
|
+
const point_glyph = vertex_renderer.glyph;
|
|
228
|
+
const point_cds = vertex_renderer.data_source;
|
|
224
229
|
const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];
|
|
225
230
|
if (pxkey) {
|
|
226
|
-
if ((0, types_1.isArray)(xs))
|
|
227
|
-
point_cds.
|
|
228
|
-
|
|
231
|
+
if ((0, types_1.isArray)(xs)) {
|
|
232
|
+
point_cds.set(pxkey, xs);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
229
235
|
point_glyph.x = { value: xs };
|
|
236
|
+
}
|
|
230
237
|
}
|
|
231
238
|
if (pykey) {
|
|
232
|
-
if ((0, types_1.isArray)(ys))
|
|
233
|
-
point_cds.
|
|
234
|
-
|
|
239
|
+
if ((0, types_1.isArray)(ys)) {
|
|
240
|
+
point_cds.set(pykey, ys);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
235
243
|
point_glyph.y = { value: ys };
|
|
244
|
+
}
|
|
236
245
|
}
|
|
237
246
|
if (styles != null) {
|
|
238
247
|
for (const key of (0, object_1.keys)(styles)) {
|
|
239
|
-
point_cds.
|
|
248
|
+
point_cds.set(key, styles[key]);
|
|
240
249
|
point_glyph[key] = { field: key };
|
|
241
250
|
}
|
|
242
251
|
}
|
|
243
252
|
else {
|
|
244
253
|
for (const col of point_cds.columns()) {
|
|
245
|
-
point_cds.
|
|
254
|
+
point_cds.set(col, []);
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
this._emit_cds_changes(point_cds, true, true, false);
|
|
@@ -251,36 +260,44 @@
|
|
|
251
260
|
if (!this.model.active) {
|
|
252
261
|
return;
|
|
253
262
|
}
|
|
263
|
+
const { renderers, node_style, end_style } = this.model;
|
|
254
264
|
const xs = [];
|
|
255
265
|
const ys = [];
|
|
256
266
|
const styles = {};
|
|
257
|
-
for (const key of (0, object_1.keys)(
|
|
267
|
+
for (const key of (0, object_1.keys)(end_style)) {
|
|
258
268
|
styles[key] = [];
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
}
|
|
270
|
+
for (let i = 0; i < renderers.length; i++) {
|
|
271
|
+
const renderer = renderers[i];
|
|
261
272
|
const cds = renderer.data_source;
|
|
262
273
|
const glyph = renderer.glyph;
|
|
263
274
|
const [xkey, ykey] = [glyph.xs.field, glyph.ys.field];
|
|
264
275
|
for (const array of cds.get_array(xkey)) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
276
|
+
(0, assert_1.assert)((0, types_1.isArray)(array));
|
|
277
|
+
xs.push(...array);
|
|
278
|
+
for (const [key, val] of (0, object_1.entries)(end_style)) {
|
|
279
|
+
styles[key].push(val);
|
|
280
|
+
}
|
|
281
|
+
for (const [key, val] of (0, object_1.entries)(node_style)) {
|
|
282
|
+
for (let index = 0; index < array.length - 2; index++) {
|
|
283
|
+
styles[key].push(val);
|
|
271
284
|
}
|
|
272
285
|
}
|
|
273
|
-
for (const key of (0, object_1.
|
|
274
|
-
styles[key].push(
|
|
286
|
+
for (const [key, val] of (0, object_1.entries)(end_style)) {
|
|
287
|
+
styles[key].push(val);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
for (const array of cds.get_array(ykey)) {
|
|
291
|
+
(0, assert_1.assert)((0, types_1.isArray)(array));
|
|
292
|
+
ys.push(...array);
|
|
275
293
|
}
|
|
276
|
-
|
|
277
|
-
Array.prototype.push.apply(ys, array);
|
|
278
|
-
if (this._drawing && (i == (this.model.renderers.length - 1))) {
|
|
294
|
+
if (this._drawing && i == renderers.length - 1) {
|
|
279
295
|
// Skip currently drawn vertex
|
|
280
296
|
xs.splice(xs.length - 1, 1);
|
|
281
297
|
ys.splice(ys.length - 1, 1);
|
|
282
|
-
for (const
|
|
283
|
-
|
|
298
|
+
for (const [_, array] of (0, object_1.entries)(styles)) {
|
|
299
|
+
array.splice(array.length - 1, 1);
|
|
300
|
+
}
|
|
284
301
|
}
|
|
285
302
|
}
|
|
286
303
|
this._set_vertices(xs, ys, styles);
|
|
@@ -289,20 +306,25 @@
|
|
|
289
306
|
const renderer = this.model.renderers[0];
|
|
290
307
|
const cds = renderer.data_source;
|
|
291
308
|
const glyph = renderer.glyph;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
const
|
|
309
|
+
if ((0, vectorization_1.isField)(glyph.xs)) {
|
|
310
|
+
const xkey = glyph.xs.field;
|
|
311
|
+
const array = cds.get_array(xkey);
|
|
312
|
+
const xidx = array.length - 1;
|
|
313
|
+
const xs = array[xidx];
|
|
296
314
|
xs.splice(xs.length - 1, 1);
|
|
297
|
-
if (xs.length == 1)
|
|
298
|
-
|
|
315
|
+
if (xs.length == 1) {
|
|
316
|
+
array.splice(xidx, 1);
|
|
317
|
+
}
|
|
299
318
|
}
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
const
|
|
319
|
+
if ((0, vectorization_1.isField)(glyph.ys)) {
|
|
320
|
+
const ykey = glyph.ys.field;
|
|
321
|
+
const array = cds.get_array(ykey);
|
|
322
|
+
const yidx = array.length - 1;
|
|
323
|
+
const ys = array[yidx];
|
|
303
324
|
ys.splice(ys.length - 1, 1);
|
|
304
|
-
if (ys.length == 1)
|
|
305
|
-
|
|
325
|
+
if (ys.length == 1) {
|
|
326
|
+
array.splice(yidx, 1);
|
|
327
|
+
}
|
|
306
328
|
}
|
|
307
329
|
this._emit_cds_changes(cds);
|
|
308
330
|
this._drawing = false;
|
|
@@ -322,22 +344,22 @@
|
|
|
322
344
|
PolyVertexDrawTool.__module__ = "geoviews.models.custom_tools";
|
|
323
345
|
(() => {
|
|
324
346
|
_a.prototype.default_view = PolyVertexDrawToolView;
|
|
325
|
-
_a.define(({
|
|
326
|
-
end_style: [
|
|
327
|
-
node_style: [
|
|
347
|
+
_a.define(({ Dict, Unknown }) => ({
|
|
348
|
+
end_style: [Dict(Unknown), {}],
|
|
349
|
+
node_style: [Dict(Unknown), {}],
|
|
328
350
|
}));
|
|
329
351
|
})();
|
|
330
352
|
},
|
|
331
|
-
"
|
|
332
|
-
__esModule();
|
|
353
|
+
"238deef1f5": /* models/poly_edit.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
333
354
|
var _a;
|
|
355
|
+
__esModule();
|
|
334
356
|
const object_1 = require("@bokehjs/core/util/object");
|
|
335
357
|
const types_1 = require("@bokehjs/core/util/types");
|
|
336
358
|
const poly_edit_tool_1 = require("@bokehjs/models/tools/edit/poly_edit_tool");
|
|
337
359
|
class PolyVertexEditToolView extends poly_edit_tool_1.PolyEditToolView {
|
|
338
360
|
deactivate() {
|
|
339
361
|
this._hide_vertices();
|
|
340
|
-
if (
|
|
362
|
+
if (this._selected_renderer == null) {
|
|
341
363
|
return;
|
|
342
364
|
}
|
|
343
365
|
else if (this._drawing) {
|
|
@@ -347,31 +369,35 @@
|
|
|
347
369
|
this._emit_cds_changes(this._selected_renderer.data_source, false, true, false);
|
|
348
370
|
}
|
|
349
371
|
_pan(ev) {
|
|
350
|
-
if (this._basepoint == null || this.model.vertex_renderer == null)
|
|
372
|
+
if (this._basepoint == null || this.model.vertex_renderer == null) {
|
|
351
373
|
return;
|
|
374
|
+
}
|
|
352
375
|
const points = this._drag_points(ev, [this.model.vertex_renderer]);
|
|
353
376
|
if (!ev.modifiers.shift) {
|
|
354
377
|
this._move_linked(points);
|
|
355
378
|
}
|
|
356
|
-
if (this._selected_renderer)
|
|
379
|
+
if (this._selected_renderer != null) {
|
|
357
380
|
this._selected_renderer.data_source.change.emit();
|
|
381
|
+
}
|
|
358
382
|
}
|
|
359
383
|
_pan_end(ev) {
|
|
360
|
-
if (this._basepoint == null || this.model.vertex_renderer == null)
|
|
384
|
+
if (this._basepoint == null || this.model.vertex_renderer == null) {
|
|
361
385
|
return;
|
|
386
|
+
}
|
|
362
387
|
const points = this._drag_points(ev, [this.model.vertex_renderer]);
|
|
363
388
|
if (!ev.modifiers.shift) {
|
|
364
389
|
this._move_linked(points);
|
|
365
390
|
}
|
|
366
391
|
this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);
|
|
367
|
-
if (this._selected_renderer) {
|
|
392
|
+
if (this._selected_renderer != null) {
|
|
368
393
|
this._emit_cds_changes(this._selected_renderer.data_source);
|
|
369
394
|
}
|
|
370
395
|
this._basepoint = null;
|
|
371
396
|
}
|
|
372
397
|
_drag_points(ev, renderers) {
|
|
373
|
-
if (this._basepoint == null)
|
|
398
|
+
if (this._basepoint == null) {
|
|
374
399
|
return [];
|
|
400
|
+
}
|
|
375
401
|
const [bx, by] = this._basepoint;
|
|
376
402
|
const points = [];
|
|
377
403
|
for (const renderer of renderers) {
|
|
@@ -390,12 +416,14 @@
|
|
|
390
416
|
for (const index of cds.selected.indices) {
|
|
391
417
|
const point = [];
|
|
392
418
|
if (xkey) {
|
|
393
|
-
|
|
394
|
-
|
|
419
|
+
const xs = cds.get(xkey);
|
|
420
|
+
point.push(xs[index]);
|
|
421
|
+
xs[index] += dx;
|
|
395
422
|
}
|
|
396
423
|
if (ykey) {
|
|
397
|
-
|
|
398
|
-
|
|
424
|
+
const ys = cds.get(ykey);
|
|
425
|
+
point.push(ys[index]);
|
|
426
|
+
ys[index] += dy;
|
|
399
427
|
}
|
|
400
428
|
point.push(dx);
|
|
401
429
|
point.push(dy);
|
|
@@ -407,39 +435,45 @@
|
|
|
407
435
|
return points;
|
|
408
436
|
}
|
|
409
437
|
_set_vertices(xs, ys, styles) {
|
|
410
|
-
if (this.model.vertex_renderer == null)
|
|
438
|
+
if (this.model.vertex_renderer == null) {
|
|
411
439
|
return;
|
|
440
|
+
}
|
|
412
441
|
const point_glyph = this.model.vertex_renderer.glyph;
|
|
413
442
|
const point_cds = this.model.vertex_renderer.data_source;
|
|
414
443
|
const [pxkey, pykey] = [point_glyph.x.field, point_glyph.y.field];
|
|
415
444
|
if (pxkey) {
|
|
416
|
-
if ((0, types_1.isArray)(xs))
|
|
417
|
-
point_cds.
|
|
418
|
-
|
|
445
|
+
if ((0, types_1.isArray)(xs)) {
|
|
446
|
+
point_cds.set(pxkey, xs);
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
419
449
|
point_glyph.x = { value: xs };
|
|
450
|
+
}
|
|
420
451
|
}
|
|
421
452
|
if (pykey) {
|
|
422
|
-
if ((0, types_1.isArray)(ys))
|
|
423
|
-
point_cds.
|
|
424
|
-
|
|
453
|
+
if ((0, types_1.isArray)(ys)) {
|
|
454
|
+
point_cds.set(pykey, ys);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
425
457
|
point_glyph.y = { value: ys };
|
|
458
|
+
}
|
|
426
459
|
}
|
|
427
460
|
if (styles != null) {
|
|
428
|
-
for (const key of (0, object_1.
|
|
429
|
-
point_cds.
|
|
461
|
+
for (const [key, array] of (0, object_1.entries)(styles)) {
|
|
462
|
+
point_cds.set(key, array);
|
|
430
463
|
point_glyph[key] = { field: key };
|
|
431
464
|
}
|
|
432
465
|
}
|
|
433
466
|
else {
|
|
434
467
|
for (const col of point_cds.columns()) {
|
|
435
|
-
point_cds.
|
|
468
|
+
point_cds.set(col, []);
|
|
436
469
|
}
|
|
437
470
|
}
|
|
438
471
|
this._emit_cds_changes(point_cds, true, true, false);
|
|
439
472
|
}
|
|
440
473
|
_move_linked(points) {
|
|
441
|
-
if (
|
|
474
|
+
if (this._selected_renderer == null) {
|
|
442
475
|
return;
|
|
476
|
+
}
|
|
443
477
|
const renderer = this._selected_renderer;
|
|
444
478
|
const glyph = renderer.glyph;
|
|
445
479
|
const cds = renderer.data_source;
|
|
@@ -461,13 +495,15 @@
|
|
|
461
495
|
}
|
|
462
496
|
}
|
|
463
497
|
_tap(ev) {
|
|
464
|
-
if (this.model.vertex_renderer == null)
|
|
498
|
+
if (this.model.vertex_renderer == null) {
|
|
465
499
|
return;
|
|
500
|
+
}
|
|
466
501
|
const renderer = this.model.vertex_renderer;
|
|
467
502
|
const point = this._map_drag(ev.sx, ev.sy, renderer);
|
|
468
|
-
if (point == null)
|
|
503
|
+
if (point == null) {
|
|
469
504
|
return;
|
|
470
|
-
|
|
505
|
+
}
|
|
506
|
+
else if (this._drawing && this._selected_renderer != null) {
|
|
471
507
|
let [x, y] = point;
|
|
472
508
|
const cds = renderer.data_source;
|
|
473
509
|
// Type once dataspecs are typed
|
|
@@ -496,10 +532,11 @@
|
|
|
496
532
|
this._select_event(ev, this._select_mode(ev), [renderer]);
|
|
497
533
|
}
|
|
498
534
|
_show_vertices(ev) {
|
|
499
|
-
if (!this.model.active)
|
|
535
|
+
if (!this.model.active) {
|
|
500
536
|
return;
|
|
537
|
+
}
|
|
501
538
|
const renderers = this._select_event(ev, "replace", this.model.renderers);
|
|
502
|
-
if (
|
|
539
|
+
if (renderers.length === 0) {
|
|
503
540
|
this._hide_vertices();
|
|
504
541
|
this._selected_renderer = null;
|
|
505
542
|
this._drawing = false;
|
|
@@ -513,31 +550,36 @@
|
|
|
513
550
|
let xs;
|
|
514
551
|
let ys;
|
|
515
552
|
if (xkey) {
|
|
516
|
-
xs = cds.
|
|
517
|
-
if (!(0, types_1.isArray)(xs))
|
|
518
|
-
cds.
|
|
553
|
+
xs = cds.get(xkey)[index];
|
|
554
|
+
if (!(0, types_1.isArray)(xs)) {
|
|
555
|
+
cds.get(xkey)[index] = xs = Array.from(xs);
|
|
556
|
+
}
|
|
519
557
|
}
|
|
520
558
|
else {
|
|
521
559
|
xs = glyph.xs.value;
|
|
522
560
|
}
|
|
523
561
|
if (ykey) {
|
|
524
|
-
ys = cds.
|
|
525
|
-
if (!(0, types_1.isArray)(ys))
|
|
526
|
-
cds.
|
|
562
|
+
ys = cds.get(ykey)[index];
|
|
563
|
+
if (!(0, types_1.isArray)(ys)) {
|
|
564
|
+
cds.get(ykey)[index] = ys = Array.from(ys);
|
|
565
|
+
}
|
|
527
566
|
}
|
|
528
567
|
else {
|
|
529
568
|
ys = glyph.ys.value;
|
|
530
569
|
}
|
|
570
|
+
const { end_style, node_style } = this.model;
|
|
531
571
|
const styles = {};
|
|
532
|
-
for (const key of (0, object_1.
|
|
533
|
-
styles[key] = [
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
572
|
+
for (const [key, val] of (0, object_1.entries)(end_style)) {
|
|
573
|
+
styles[key] = [val];
|
|
574
|
+
}
|
|
575
|
+
for (const [key, val] of (0, object_1.entries)(node_style)) {
|
|
576
|
+
for (let index = 0; index < xs.length - 2; index++) {
|
|
577
|
+
styles[key].push(val);
|
|
537
578
|
}
|
|
538
579
|
}
|
|
539
|
-
for (const key of (0, object_1.
|
|
540
|
-
styles[key].push(
|
|
580
|
+
for (const [key, val] of (0, object_1.entries)(end_style)) {
|
|
581
|
+
styles[key].push(val);
|
|
582
|
+
}
|
|
541
583
|
this._selected_renderer = renderer;
|
|
542
584
|
this._set_vertices(xs, ys, styles);
|
|
543
585
|
}
|
|
@@ -555,15 +597,15 @@
|
|
|
555
597
|
PolyVertexEditTool.__module__ = "geoviews.models.custom_tools";
|
|
556
598
|
(() => {
|
|
557
599
|
_a.prototype.default_view = PolyVertexEditToolView;
|
|
558
|
-
_a.define(({
|
|
559
|
-
end_style: [
|
|
560
|
-
node_style: [
|
|
600
|
+
_a.define(({ Dict, Unknown }) => ({
|
|
601
|
+
end_style: [Dict(Unknown), {}],
|
|
602
|
+
node_style: [Dict(Unknown), {}],
|
|
561
603
|
}));
|
|
562
604
|
})();
|
|
563
605
|
},
|
|
564
|
-
"
|
|
565
|
-
__esModule();
|
|
606
|
+
"7d18037934": /* models/restore_tool.js */ function _(require, module, exports, __esModule, __esExport) {
|
|
566
607
|
var _a;
|
|
608
|
+
__esModule();
|
|
567
609
|
const action_tool_1 = require("@bokehjs/models/tools/actions/action_tool");
|
|
568
610
|
const column_data_source_1 = require("@bokehjs/models/sources/column_data_source");
|
|
569
611
|
const icons_css_1 = require("@bokehjs/styles/icons.css");
|
|
@@ -571,10 +613,11 @@
|
|
|
571
613
|
doit() {
|
|
572
614
|
const sources = this.model.sources;
|
|
573
615
|
for (const source of sources) {
|
|
574
|
-
|
|
616
|
+
const new_data = source.buffer?.pop();
|
|
617
|
+
if (new_data == null) {
|
|
575
618
|
continue;
|
|
576
619
|
}
|
|
577
|
-
source.data =
|
|
620
|
+
source.data = new_data;
|
|
578
621
|
source.change.emit();
|
|
579
622
|
source.properties.data.change.emit();
|
|
580
623
|
}
|
|
@@ -600,5 +643,5 @@
|
|
|
600
643
|
}));
|
|
601
644
|
})();
|
|
602
645
|
},
|
|
603
|
-
}, "c764d38756", {"index":"c764d38756","models/index":"b4555bea44","models/checkpoint_tool":"
|
|
646
|
+
}, "c764d38756", {"index":"c764d38756","models/index":"b4555bea44","models/checkpoint_tool":"443ddb828d","models/clear_tool":"2942ff039e","models/poly_draw":"3557d74ee0","models/poly_edit":"238deef1f5","models/restore_tool":"7d18037934"}, {});});
|
|
604
647
|
//# sourceMappingURL=geoviews.js.map
|