plexora 0.0.1__py3-none-any.whl
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.
- plexora/__init__.py +129 -0
- plexora/__main__.py +15 -0
- plexora/_url.py +105 -0
- plexora/api/__init__.py +55 -0
- plexora/api/dataset.py +398 -0
- plexora/api/http.py +19 -0
- plexora/api/plugin.py +541 -0
- plexora/api/store.py +221 -0
- plexora/cli.py +777 -0
- plexora/client/dist/354_bundle.js +2 -0
- plexora/client/dist/354_bundle.js.LICENSE.txt +20 -0
- plexora/client/dist/418_bundle.js +2 -0
- plexora/client/dist/418_bundle.js.LICENSE.txt +1 -0
- plexora/client/dist/693b935cb1f907814be9c6199a68c217.svg +19 -0
- plexora/client/dist/713c134ff47cd328a5b711526f151082.svg +18 -0
- plexora/client/dist/770_bundle.js +1 -0
- plexora/client/dist/ff743f408972e0e96ca9153ed5ae4c83.svg +23 -0
- plexora/client/dist/vendor_bundle.js +2 -0
- plexora/client/dist/vendor_bundle.js.LICENSE.txt +308 -0
- plexora/client/external/openseadragon-bin-2.4.0/LICENSE.txt +28 -0
- plexora/client/external/openseadragon-bin-2.4.0/canvas-overlay-hd.js +140 -0
- plexora/client/external/openseadragon-bin-2.4.0/changelog.txt +501 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/.gitattributes +17 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/LICENSE.txt +116 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/Toolbar.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/fullpage.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/home.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/next.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/previous.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/rotateleft.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/rotateright.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/Photoshop/zoom.psd +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/README.md +9 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/fullpage_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/fullpage_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/fullpage_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/fullpage_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/home_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/home_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/home_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/home_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/next_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/next_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/next_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/next_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/previous_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/previous_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/previous_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/previous_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateleft_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateleft_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateleft_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateleft_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateright_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateright_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateright_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/rotateright_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomin_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomin_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomin_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomin_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomout_grouphover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomout_hover.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomout_pressed.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-flat-toolbar-icons-master/images/zoomout_rest.png +0 -0
- plexora/client/external/openseadragon-bin-2.4.0/openseadragon-scalebar.js +562 -0
- plexora/client/src/css/import.css +474 -0
- plexora/client/src/css/main.css +903 -0
- plexora/client/src/css/openProject.css +363 -0
- plexora/client/src/css/quickView.css +166 -0
- plexora/client/src/css/tokens.css +51 -0
- plexora/client/src/css/viewer.css +1655 -0
- plexora/client/src/img/apple-touch-icon.png +0 -0
- plexora/client/src/img/favicon.ico +0 -0
- plexora/client/src/img/logo.ai +8892 -33
- plexora/client/src/img/logo.svg +1 -0
- plexora/client/src/img/logo_with_text.ai +9011 -34
- plexora/client/src/img/logo_with_text.svg +1 -0
- plexora/client/src/js/main.js +704 -0
- plexora/client/src/js/pluginRegistry.js +108 -0
- plexora/client/src/js/services/appStatus.js +286 -0
- plexora/client/src/js/services/browsePicker.js +73 -0
- plexora/client/src/js/services/dataLayer.js +400 -0
- plexora/client/src/js/services/datasetContext.js +143 -0
- plexora/client/src/js/services/glRenderer.js +143 -0
- plexora/client/src/js/services/importFormValidation.js +257 -0
- plexora/client/src/js/services/numericData.js +100 -0
- plexora/client/src/js/services/passVariablesToFrontend.js +20 -0
- plexora/client/src/js/services/simpleEventHandler.js +25 -0
- plexora/client/src/js/vendor.js +29 -0
- plexora/client/src/js/views/channelList.js +663 -0
- plexora/client/src/js/views/colorSwatchPicker.js +202 -0
- plexora/client/src/js/views/columnClassifier.js +146 -0
- plexora/client/src/js/views/coordinateField.js +133 -0
- plexora/client/src/js/views/dataSourceField.js +276 -0
- plexora/client/src/js/views/imageViewer.js +3306 -0
- plexora/client/src/js/views/miniMap.js +787 -0
- plexora/client/src/js/views/navbarControls.js +178 -0
- plexora/client/src/js/views/openProjectPage.js +239 -0
- plexora/client/src/js/views/projectEdit.js +335 -0
- plexora/client/src/js/views/quickViewLanding.js +136 -0
- plexora/client/src/js/views/rainbow.js +326 -0
- plexora/client/src/js/views/requirementsModal.js +572 -0
- plexora/client/src/js/views/rgbImageViewer.js +115 -0
- plexora/client/src/js/views/searchableSelect.js +411 -0
- plexora/client/src/js/views/segmentationProgress.js +122 -0
- plexora/client/src/js/views/toolLoader.js +747 -0
- plexora/client/src/js/views/viewerControls.js +689 -0
- plexora/client/src/js/views/viewerManager.js +434 -0
- plexora/client/src/js/views/viewerSidebar.js +1117 -0
- plexora/client/src/js/workers/tileDecoder.js +130 -0
- plexora/client/src/shaders/frag.glsl +528 -0
- plexora/client/src/shaders/vert.glsl +12 -0
- plexora/client/templates/base.html +212 -0
- plexora/client/templates/index.html +238 -0
- plexora/client/templates/open_project.html +96 -0
- plexora/client/templates/project_columns.html +86 -0
- plexora/client/templates/project_edit.html +196 -0
- plexora/client/templates/upload.html +118 -0
- plexora/connect.py +528 -0
- plexora/datasource.py +782 -0
- plexora/jupyter.py +406 -0
- plexora/notebook_env.py +232 -0
- plexora/paths.py +486 -0
- plexora/plugins/__init__.py +12 -0
- plexora/plugins/cell_explorer/__init__.py +100 -0
- plexora/plugins/cell_explorer/server/__init__.py +11 -0
- plexora/plugins/cell_explorer/server/routes.py +167 -0
- plexora/plugins/cell_explorer/server/state.py +281 -0
- plexora/plugins/cell_explorer/server/values.py +145 -0
- plexora/plugins/cell_explorer/server/variables.py +367 -0
- plexora/plugins/cell_explorer/static/cellExplorerApi.js +158 -0
- plexora/plugins/cell_explorer/static/cellExplorerColors.js +316 -0
- plexora/plugins/cell_explorer/static/cellExplorerContinuous.js +403 -0
- plexora/plugins/cell_explorer/static/cellExplorerFigureBridge.js +133 -0
- plexora/plugins/cell_explorer/static/cellExplorerLegend.js +188 -0
- plexora/plugins/cell_explorer/static/cellExplorerRoiBridge.js +822 -0
- plexora/plugins/cell_explorer/static/cellExplorerSidebarController.js +826 -0
- plexora/plugins/cell_explorer/static/cellExplorerState.js +372 -0
- plexora/plugins/cell_explorer/static/cell_explorer.css +752 -0
- plexora/plugins/cell_explorer/templates/cell_explorer/panel.html +137 -0
- plexora/plugins/figure_builder/__init__.py +125 -0
- plexora/plugins/figure_builder/server/__init__.py +7 -0
- plexora/plugins/figure_builder/server/compose.py +365 -0
- plexora/plugins/figure_builder/server/export.py +784 -0
- plexora/plugins/figure_builder/server/export_jobs.py +148 -0
- plexora/plugins/figure_builder/server/operations.py +556 -0
- plexora/plugins/figure_builder/server/pixels.py +142 -0
- plexora/plugins/figure_builder/server/provenance.py +174 -0
- plexora/plugins/figure_builder/server/render.py +278 -0
- plexora/plugins/figure_builder/server/repository.py +701 -0
- plexora/plugins/figure_builder/server/routes.py +594 -0
- plexora/plugins/figure_builder/server/schema.py +1023 -0
- plexora/plugins/figure_builder/server/sources.py +120 -0
- plexora/plugins/figure_builder/server/textmetrics.py +155 -0
- plexora/plugins/figure_builder/static/figureActions.js +363 -0
- plexora/plugins/figure_builder/static/figureBuilderApi.js +255 -0
- plexora/plugins/figure_builder/static/figureCanvas.js +2362 -0
- plexora/plugins/figure_builder/static/figureCaptureBoxes.js +369 -0
- plexora/plugins/figure_builder/static/figureCaptureDock.js +466 -0
- plexora/plugins/figure_builder/static/figureCaptureTool.js +1034 -0
- plexora/plugins/figure_builder/static/figureConfirm.js +136 -0
- plexora/plugins/figure_builder/static/figureContextBar.js +1193 -0
- plexora/plugins/figure_builder/static/figureContextMenu.js +253 -0
- plexora/plugins/figure_builder/static/figureDocumentState.js +275 -0
- plexora/plugins/figure_builder/static/figureExportUi.js +174 -0
- plexora/plugins/figure_builder/static/figureLibrary.js +247 -0
- plexora/plugins/figure_builder/static/figureQuickEdit.js +628 -0
- plexora/plugins/figure_builder/static/figureRichText.js +634 -0
- plexora/plugins/figure_builder/static/figureSceneSnapshot.js +361 -0
- plexora/plugins/figure_builder/static/figureSchema.js +218 -0
- plexora/plugins/figure_builder/static/figureSidebarController.js +1159 -0
- plexora/plugins/figure_builder/static/figureTextEditor.js +503 -0
- plexora/plugins/figure_builder/static/figureTextPanel.js +491 -0
- plexora/plugins/figure_builder/static/figureViewOptions.js +273 -0
- plexora/plugins/figure_builder/static/figureWorkspace.js +2030 -0
- plexora/plugins/figure_builder/static/figure_builder.css +3292 -0
- plexora/plugins/figure_builder/templates/figure_builder/library.html +74 -0
- plexora/plugins/figure_builder/templates/figure_builder/workspace.html +27 -0
- plexora/plugins/figure_builder/templates/figure_builder/workspace_body.html +458 -0
- plexora/plugins/gating/__init__.py +76 -0
- plexora/plugins/gating/server/__init__.py +0 -0
- plexora/plugins/gating/server/anndata_gates.py +367 -0
- plexora/plugins/gating/server/database.py +16 -0
- plexora/plugins/gating/server/model.py +320 -0
- plexora/plugins/gating/server/routes.py +235 -0
- plexora/plugins/gating/static/csvGatingList.js +947 -0
- plexora/plugins/gating/static/gating.css +289 -0
- plexora/plugins/gating/static/gatingApi.js +221 -0
- plexora/plugins/gating/static/gatingSidebarController.js +513 -0
- plexora/plugins/gating/templates/gating/legacy.html +26 -0
- plexora/plugins/gating/templates/gating/panel.html +69 -0
- plexora/plugins/roi/__init__.py +95 -0
- plexora/plugins/roi/server/__init__.py +8 -0
- plexora/plugins/roi/server/adapters.py +655 -0
- plexora/plugins/roi/server/geojson.py +267 -0
- plexora/plugins/roi/server/geometry.py +181 -0
- plexora/plugins/roi/server/mapping.py +169 -0
- plexora/plugins/roi/server/operations.py +293 -0
- plexora/plugins/roi/server/repository.py +215 -0
- plexora/plugins/roi/server/routes.py +409 -0
- plexora/plugins/roi/server/schema.py +323 -0
- plexora/plugins/roi/static/roi.css +583 -0
- plexora/plugins/roi/static/roiApi.js +177 -0
- plexora/plugins/roi/static/roiFigureBridge.js +107 -0
- plexora/plugins/roi/static/roiGeometry.js +350 -0
- plexora/plugins/roi/static/roiRenderer.js +278 -0
- plexora/plugins/roi/static/roiSidebarController.js +1038 -0
- plexora/plugins/roi/static/roiState.js +518 -0
- plexora/plugins/roi/static/roiTools.js +993 -0
- plexora/plugins/roi/templates/roi/panel.html +240 -0
- plexora/proxy.py +57 -0
- plexora/server/models/adapters/__init__.py +94 -0
- plexora/server/models/adapters/anndata_adapter.py +388 -0
- plexora/server/models/adapters/base.py +93 -0
- plexora/server/models/adapters/classify.py +192 -0
- plexora/server/models/adapters/csv_adapter.py +105 -0
- plexora/server/models/adapters/inspection.py +265 -0
- plexora/server/models/adapters/spatialdata_adapter.py +248 -0
- plexora/server/models/centroid_tiles.py +305 -0
- plexora/server/models/data_model.py +1659 -0
- plexora/server/models/database_model.py +169 -0
- plexora/server/models/project.py +1270 -0
- plexora/server/plugins.py +199 -0
- plexora/server/routes/browse_routes.py +41 -0
- plexora/server/routes/data_routes.py +294 -0
- plexora/server/routes/import_routes.py +603 -0
- plexora/server/routes/page_routes.py +139 -0
- plexora/server/routes/project_routes.py +438 -0
- plexora/server/routes/quick_view_routes.py +62 -0
- plexora/server/routes/system_routes.py +39 -0
- plexora/server/routes/tool_routes.py +418 -0
- plexora/server/utils/addHEColumns.py +11 -0
- plexora/server/utils/fast_png.py +97 -0
- plexora/server/utils/fullConversion.py +50 -0
- plexora/server/utils/native_dialog.py +168 -0
- plexora/server/utils/pre_normalization.py +47 -0
- plexora/server/utils/segmentation_pyramid.py +598 -0
- plexora/server/utils/smallestenclosingcircle.py +126 -0
- plexora/server/utils/tiffsurgeon.py +372 -0
- plexora/server_cli.py +48 -0
- plexora/test.py +0 -0
- plexora-0.0.1.dist-info/METADATA +341 -0
- plexora-0.0.1.dist-info/RECORD +248 -0
- plexora-0.0.1.dist-info/WHEEL +5 -0
- plexora-0.0.1.dist-info/entry_points.txt +12 -0
- plexora-0.0.1.dist-info/licenses/LICENSE +207 -0
- plexora-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
+
(global = global || self, global.rainbow = factory());
|
|
5
|
+
}(this, function () { 'use strict';
|
|
6
|
+
|
|
7
|
+
function rainbow (){
|
|
8
|
+
let pickerSize = 120,
|
|
9
|
+
container,
|
|
10
|
+
pickerGroup,
|
|
11
|
+
huePickerElm,
|
|
12
|
+
hueHandleElm,
|
|
13
|
+
slPickerElm,
|
|
14
|
+
slHandleElm,
|
|
15
|
+
inputElm,
|
|
16
|
+
handleSize = 15,
|
|
17
|
+
barThickness = 8,
|
|
18
|
+
hueScale = d3.scaleLinear().domain([0,pickerSize]).range([0,360]).clamp(true),
|
|
19
|
+
//(t)=>d3.hsl(t * 360, 1, 0.5) + ""),
|
|
20
|
+
satScale = d3.scaleLinear().domain([0,pickerSize]).range([0, 1]).clamp(true),
|
|
21
|
+
lumScale = d3.scaleLinear().domain([pickerSize, 0]).range([0, 1]).clamp(true),
|
|
22
|
+
hue=360, sat=0.5, lum=0.5,
|
|
23
|
+
gradient = 'linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)',
|
|
24
|
+
hueDrag = d3.drag()
|
|
25
|
+
.on("drag", (e)=>{
|
|
26
|
+
hueHandleMoved(e.y);
|
|
27
|
+
})
|
|
28
|
+
.on("end", (e)=>{
|
|
29
|
+
hueHandleEnd(e.y);
|
|
30
|
+
}),
|
|
31
|
+
slDrag = d3.drag()
|
|
32
|
+
.on("drag", (e)=>{
|
|
33
|
+
slHandleMoved(e);
|
|
34
|
+
})
|
|
35
|
+
.on("end", (e)=>{
|
|
36
|
+
slHandleEnd(e);
|
|
37
|
+
}),
|
|
38
|
+
drag = d3.drag()
|
|
39
|
+
.on("drag", (e)=>{
|
|
40
|
+
let dx = e.dx;
|
|
41
|
+
let dy = e.dy;
|
|
42
|
+
container
|
|
43
|
+
.style('left', parseInt(container.style('left'), 10) + dx+'px')
|
|
44
|
+
.style('top', parseInt(container.style('top'), 10) + dy+'px');
|
|
45
|
+
}),
|
|
46
|
+
listeners = d3.dispatch('handlemove', 'handleend', 'save', 'close');
|
|
47
|
+
|
|
48
|
+
function picker(selection){
|
|
49
|
+
|
|
50
|
+
container = selection.select('.picker-container');
|
|
51
|
+
if (container.empty()){
|
|
52
|
+
container = selection.append('div')
|
|
53
|
+
.attr('class', 'picker-container')
|
|
54
|
+
.style('position', 'fixed')
|
|
55
|
+
.style('padding', '10px')
|
|
56
|
+
.style('padding-left', '15px')
|
|
57
|
+
.style('border-radius', '4px')
|
|
58
|
+
.style('box-shadow', '0px 1px 3px 0px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 2px 1px -1px rgba(0,0,0,0.12)')
|
|
59
|
+
.style('transform', 'translate(-50%,10px)')
|
|
60
|
+
.style('background-color', '#fff')
|
|
61
|
+
.style('z-index', '999')
|
|
62
|
+
.call(drag);
|
|
63
|
+
// .style('align-items', 'center');
|
|
64
|
+
pickerGroup = container.append('div')
|
|
65
|
+
.attr("class", "picker-group")
|
|
66
|
+
.style("display", "flex");
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
// saturation and luminance picker
|
|
70
|
+
let slPickerGroup = pickerGroup.append('div')
|
|
71
|
+
.attr("class", "sl-picker")
|
|
72
|
+
.style('position', 'relative');
|
|
73
|
+
|
|
74
|
+
slPickerElm = slPickerGroup.append("div")
|
|
75
|
+
.style("width", `${pickerSize}px`)
|
|
76
|
+
.style("height", `${pickerSize}px`)
|
|
77
|
+
.style("border", '1px solid #eeeee')
|
|
78
|
+
.style('background-color', d3.hsl(hue, 1.0, 0.5))
|
|
79
|
+
.style("background-image", "linear-gradient(180deg, white, rgba(255,255,255,0) 50%),linear-gradient(0deg, black, rgba(0,0,0,0) 50%),linear-gradient(90deg, gray, rgba(128,128,128,0))")
|
|
80
|
+
// .style("background", slGradient(d3.hsl(hue, 1.0, 0.5)))
|
|
81
|
+
.on('click', clickSlArea);
|
|
82
|
+
|
|
83
|
+
slHandleElm = slPickerGroup.append('div')
|
|
84
|
+
.attr('class', 'sl-picker-handle')
|
|
85
|
+
.style('cursor', 'pointer')
|
|
86
|
+
.style('position', 'absolute')
|
|
87
|
+
.style('transform', 'translate(-50%,-50%)')
|
|
88
|
+
.style('width', `${handleSize}px`)
|
|
89
|
+
.style('height', `${handleSize}px`)
|
|
90
|
+
.style('top', `${lumScale.invert(lum)}px`)
|
|
91
|
+
.style('left', `${satScale.invert(sat)}px`)
|
|
92
|
+
.style('border-radius', '50%')
|
|
93
|
+
.style('background-color', d3.hsl(hue, sat, lum))
|
|
94
|
+
.style('border', '2px solid white')
|
|
95
|
+
.call(slDrag);
|
|
96
|
+
|
|
97
|
+
// hue picker
|
|
98
|
+
huePickerElm = pickerGroup.append('div')
|
|
99
|
+
.attr('class', 'hue-picker')
|
|
100
|
+
.style("margin-left", "12px")
|
|
101
|
+
.style('position', 'relative')
|
|
102
|
+
.style('height', `${pickerSize}px`);
|
|
103
|
+
|
|
104
|
+
huePickerElm.append('div')
|
|
105
|
+
.attr('class', 'hue-picker-bar')
|
|
106
|
+
.style('height', '100%')
|
|
107
|
+
.style('width', `${barThickness}px`)
|
|
108
|
+
.style('border-radius', '4px')
|
|
109
|
+
.style('background', gradient)
|
|
110
|
+
.on('click', clickHueBar);
|
|
111
|
+
|
|
112
|
+
hueHandleElm = huePickerElm.append('div')
|
|
113
|
+
.attr('class', 'hue-picker-handle')
|
|
114
|
+
.style('cursor', 'pointer')
|
|
115
|
+
.style('position', 'absolute')
|
|
116
|
+
.style('transform', 'translate(-50%,-50%)')
|
|
117
|
+
.style('left', '50%')
|
|
118
|
+
.style('top', `${hueScale.invert(hue)}px`)
|
|
119
|
+
.style('width', `${handleSize}px`)
|
|
120
|
+
.style('height', `${handleSize}px`)
|
|
121
|
+
.style('border-radius', '50%')
|
|
122
|
+
.style('background-color', d3.hsl(hue, 1.0, 0.5))
|
|
123
|
+
.style('border', '2px solid white')
|
|
124
|
+
.call(hueDrag);
|
|
125
|
+
|
|
126
|
+
let bottomGroup = container.append('div')
|
|
127
|
+
.style('display', 'flex')
|
|
128
|
+
.style('margin-top', '10px');
|
|
129
|
+
inputElm = bottomGroup.append('input')
|
|
130
|
+
.style("width", `${pickerSize-25}px`)
|
|
131
|
+
.style('outline', 'none')
|
|
132
|
+
.style('border', 'none')
|
|
133
|
+
.style('color', '#757575')
|
|
134
|
+
.style('font-size', '12px')
|
|
135
|
+
.style('border-radius', '4px')
|
|
136
|
+
.style('background', '#eeeeee')
|
|
137
|
+
.attr('spellcheck', 'false')
|
|
138
|
+
.attr('value', d3.hsl(hue, sat, lum))
|
|
139
|
+
.on('input', textChanged);
|
|
140
|
+
|
|
141
|
+
bottomGroup.append('div')
|
|
142
|
+
.attr('class', 'save')
|
|
143
|
+
.style('cursor', 'pointer')
|
|
144
|
+
.style('text-align', 'center')
|
|
145
|
+
// .style('font-family', 'Arial, Helvetica, sans-serif')
|
|
146
|
+
.style('border-radius', '50%')
|
|
147
|
+
// .style('font-size', '12px')
|
|
148
|
+
.style('margin-left', '5px')
|
|
149
|
+
.style('width', '24px')
|
|
150
|
+
.style('height', '24px')
|
|
151
|
+
.style('background-repeat', 'no-repeat')
|
|
152
|
+
.style('background-image','url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxMS45OTkgNTExLjk5OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjk5OSA1MTEuOTk5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiIGNsYXNzPSIiPjxnPjxnPgoJPGc+CgkJPHBhdGggZD0iTTUwNi4yMzEsNzUuNTA4Yy03LjY4OS03LjY5LTIwLjE1OC03LjY5LTI3Ljg0OSwwbC0zMTkuMjEsMzE5LjIxMUwzMy42MTcsMjY5LjE2M2MtNy42ODktNy42OTEtMjAuMTU4LTcuNjkxLTI3Ljg0OSwwICAgIGMtNy42OSw3LjY5LTcuNjksMjAuMTU4LDAsMjcuODQ5bDEzOS40ODEsMTM5LjQ4MWM3LjY4Nyw3LjY4NywyMC4xNiw3LjY4OSwyNy44NDksMGwzMzMuMTMzLTMzMy4xMzYgICAgQzUxMy45MjEsOTUuNjY2LDUxMy45MjEsODMuMTk4LDUwNi4yMzEsNzUuNTA4eiIgZGF0YS1vcmlnaW5hbD0iIzAwMDAwMCIgY2xhc3M9ImFjdGl2ZS1wYXRoIiBzdHlsZT0iZmlsbDojOUU5RTlFIiBkYXRhLW9sZF9jb2xvcj0iIzllOWU5ZSI+PC9wYXRoPgoJPC9nPgo8L2c+PC9nPiA8L3N2Zz4=)')
|
|
153
|
+
.style('background-size', '12px')
|
|
154
|
+
.style('background-position', 'center')
|
|
155
|
+
.on('mouseenter',function(){
|
|
156
|
+
d3.select(this).style('background-color', '#eee');
|
|
157
|
+
})
|
|
158
|
+
.on('mouseleave',function(){
|
|
159
|
+
d3.select(this).style('background-color', null);
|
|
160
|
+
})
|
|
161
|
+
.on('click', pickersave);
|
|
162
|
+
|
|
163
|
+
bottomGroup.append('div')
|
|
164
|
+
.attr('class', 'close')
|
|
165
|
+
.style('cursor', 'pointer')
|
|
166
|
+
.style('text-align', 'center')
|
|
167
|
+
// .style('font-family', 'Arial, Helvetica, sans-serif')
|
|
168
|
+
.style('border-radius', '50%')
|
|
169
|
+
// .style('font-size', '12px')
|
|
170
|
+
.style('margin-left', '5px')
|
|
171
|
+
.style('width', '24px')
|
|
172
|
+
.style('height', '24px')
|
|
173
|
+
.style('background-repeat', 'no-repeat')
|
|
174
|
+
.style('background-image','url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxMi4wMDEgNTEyLjAwMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyLjAwMSA1MTIuMDAxOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiPjxnPjxnPgoJPGc+CgkJPHBhdGggZD0iTTUwNS45MjIsNDc2LjU2N0wyODUuMzU1LDI1Nkw1MDUuOTIsMzUuNDM1YzguMTA2LTguMTA1LDguMTA2LTIxLjI0OCwwLTI5LjM1NGMtOC4xMDUtOC4xMDYtMjEuMjQ4LTguMTA2LTI5LjM1NCwwICAgIEwyNTYuMDAxLDIyNi42NDZMMzUuNDM0LDYuMDgxYy04LjEwNS04LjEwNi0yMS4yNDgtOC4xMDYtMjkuMzU0LDBjLTguMTA2LDguMTA1LTguMTA2LDIxLjI0OCwwLDI5LjM1NEwyMjYuNjQ2LDI1Nkw2LjA4LDQ3Ni41NjcgICAgYy04LjEwNiw4LjEwNi04LjEwNiwyMS4yNDgsMCwyOS4zNTRjOC4xMDUsOC4xMDUsMjEuMjQ4LDguMTA2LDI5LjM1NCwwbDIyMC41NjctMjIwLjU2N2wyMjAuNTY3LDIyMC41NjcgICAgYzguMTA1LDguMTA1LDIxLjI0OCw4LjEwNiwyOS4zNTQsMFM1MTQuMDI4LDQ4NC42NzMsNTA1LjkyMiw0NzYuNTY3eiIgZGF0YS1vcmlnaW5hbD0iIzAwMDAwMCIgY2xhc3M9ImFjdGl2ZS1wYXRoIiBzdHlsZT0iZmlsbDojOUU5RTlFIiBkYXRhLW9sZF9jb2xvcj0iIzllOWU5ZSI+PC9wYXRoPgoJPC9nPgo8L2c+PC9nPiA8L3N2Zz4=)')
|
|
175
|
+
.style('background-size', '12px')
|
|
176
|
+
.style('background-position', 'center')
|
|
177
|
+
.on('mouseenter',function(){
|
|
178
|
+
d3.select(this).style('background-color', '#eee');
|
|
179
|
+
})
|
|
180
|
+
.on('mouseleave',function(){
|
|
181
|
+
d3.select(this).style('background-color', null);
|
|
182
|
+
})
|
|
183
|
+
.on('click', pickerclose);
|
|
184
|
+
}
|
|
185
|
+
huePickerElm.style('height', `${pickerSize}px`);
|
|
186
|
+
|
|
187
|
+
hueHandleElm.style('width', `${handleSize}px`)
|
|
188
|
+
.style('height', `${handleSize}px`);
|
|
189
|
+
|
|
190
|
+
let initY = parseInt(hueHandleElm.style('top'));
|
|
191
|
+
updateHueHandle(initY);
|
|
192
|
+
}
|
|
193
|
+
picker.pickerSize = function(value) {
|
|
194
|
+
if (!arguments.length) return pickerSize;
|
|
195
|
+
pickerSize = value;
|
|
196
|
+
return picker;
|
|
197
|
+
};
|
|
198
|
+
picker.handleSize = function(value) {
|
|
199
|
+
if (!arguments.length) return handleSize;
|
|
200
|
+
handleSize = value;
|
|
201
|
+
return picker;
|
|
202
|
+
};
|
|
203
|
+
picker.barThickness = function(value) {
|
|
204
|
+
if (!arguments.length) return barThickness;
|
|
205
|
+
barThickness = value;
|
|
206
|
+
return picker;
|
|
207
|
+
};
|
|
208
|
+
picker.on = function() {
|
|
209
|
+
var value = listeners.on.apply(listeners, arguments);
|
|
210
|
+
return value === listeners ? picker : value;
|
|
211
|
+
};
|
|
212
|
+
picker.show = function(x,y){
|
|
213
|
+
container.style('display', null)
|
|
214
|
+
.style('left', x+'px')
|
|
215
|
+
.style('top', y+'px');
|
|
216
|
+
};
|
|
217
|
+
picker.hide = function(){
|
|
218
|
+
container.style('display', 'none');
|
|
219
|
+
};
|
|
220
|
+
picker.set = function(hsl){
|
|
221
|
+
let sl = {
|
|
222
|
+
x:satScale.invert(hsl.s?hsl.s:sat),
|
|
223
|
+
y:lumScale.invert(hsl.l)
|
|
224
|
+
};
|
|
225
|
+
updateHueHandle(hueScale.invert(hsl.h?hsl.h:hue), true);
|
|
226
|
+
updateSlHandle(sl);
|
|
227
|
+
|
|
228
|
+
// if (hsl.l==0){
|
|
229
|
+
// // hueHandleElm.style('display', 'none');
|
|
230
|
+
// // blackElm.style('width', `${handleSize}px`)
|
|
231
|
+
// // .style('height', `${handleSize}px`)
|
|
232
|
+
// }else{
|
|
233
|
+
// let x = pickerSize*hsl.h/360;
|
|
234
|
+
// x = x<0? 0: (x>pickerSize?pickerSize:x);
|
|
235
|
+
// hueHandleElm.style('background-color', hsl.toString());
|
|
236
|
+
|
|
237
|
+
// // blackElm.style('width', `${1.2*barThickness}px`)
|
|
238
|
+
// // .style('height', `${1.2*barThickness}px`)
|
|
239
|
+
// }
|
|
240
|
+
};
|
|
241
|
+
// function reset(){
|
|
242
|
+
// picker.set(d3.hsl('black'));
|
|
243
|
+
// listeners.apply("handleend", this, [d3.hsl('black').toString(),null,...arguments]);
|
|
244
|
+
// }
|
|
245
|
+
function textChanged(value){
|
|
246
|
+
const inputVal = d3.select('.picker-container input').node().value;
|
|
247
|
+
const hsl = d3.hsl(d3.color(inputVal));
|
|
248
|
+
let sl = {
|
|
249
|
+
x:satScale.invert(hsl.s?hsl.s:sat),
|
|
250
|
+
y:lumScale.invert(hsl.l)
|
|
251
|
+
};
|
|
252
|
+
updateHueHandle(hueScale.invert(hsl.h?hsl.h:hue), true);
|
|
253
|
+
updateSlHandle(sl, true);
|
|
254
|
+
listeners.apply("handleend", this, [d3.hsl(hue, sat, lum),...arguments]);
|
|
255
|
+
}
|
|
256
|
+
function pickerclose(){
|
|
257
|
+
picker.hide();
|
|
258
|
+
listeners.apply("close", this, [d3.hsl(hue, sat, lum),...arguments]);
|
|
259
|
+
}
|
|
260
|
+
function pickersave(){
|
|
261
|
+
picker.hide();
|
|
262
|
+
listeners.apply("save", this, [d3.hsl(hue, sat, lum),...arguments]);
|
|
263
|
+
}
|
|
264
|
+
function clickHueBar(e){
|
|
265
|
+
let loc = d3.pointer(e)[1];
|
|
266
|
+
updateHueHandle(loc);
|
|
267
|
+
listeners.apply("handleend", this, [d3.hsl(hue, sat, lum),loc,'hue',...arguments]);
|
|
268
|
+
}
|
|
269
|
+
function clickSlArea(e){
|
|
270
|
+
let loc = d3.pointer(e);
|
|
271
|
+
loc = {x:loc[0], y:loc[1]};
|
|
272
|
+
updateSlHandle(loc);
|
|
273
|
+
listeners.apply("handleend", this, [d3.hsl(hue, sat, lum),loc,'sl',...arguments]);
|
|
274
|
+
}
|
|
275
|
+
function hueHandleMoved(loc){
|
|
276
|
+
updateHueHandle(loc);
|
|
277
|
+
listeners.apply("handlemove", this, [d3.hsl(hue, sat, lum),loc,'hue',...arguments]);
|
|
278
|
+
}
|
|
279
|
+
function hueHandleEnd(loc){
|
|
280
|
+
updateHueHandle(loc);
|
|
281
|
+
listeners.apply("handleend", this, [d3.hsl(hue, sat, lum),loc,'hue',...arguments]);
|
|
282
|
+
}
|
|
283
|
+
function slHandleMoved(loc){
|
|
284
|
+
updateSlHandle(loc);
|
|
285
|
+
listeners.apply("handlemove", this, [d3.hsl(hue, sat, lum),loc,'sl',...arguments]);
|
|
286
|
+
}
|
|
287
|
+
function slHandleEnd(loc){
|
|
288
|
+
updateSlHandle(loc);
|
|
289
|
+
listeners.apply("handleend", this, [d3.hsl(hue, sat, lum),loc,'sl',...arguments]);
|
|
290
|
+
}
|
|
291
|
+
function updateHueHandle(loc, dontUpdateText=false){
|
|
292
|
+
hue = hueScale(loc);
|
|
293
|
+
|
|
294
|
+
hueHandleElm.style('top', `${hueScale.invert(hue)}px`)
|
|
295
|
+
.style('background-color', d3.hsl(hue, 1.0, 0.5));
|
|
296
|
+
|
|
297
|
+
slPickerElm.style('background-color', d3.hsl(hue, 1.0, 0.5));
|
|
298
|
+
|
|
299
|
+
slHandleElm.style('background-color', d3.hsl(hue, sat, lum));
|
|
300
|
+
if (!dontUpdateText){
|
|
301
|
+
inputElm.node().value = d3.hsl(hue, sat, lum);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function updateSlHandle(loc, dontUpdateText=false){
|
|
305
|
+
sat = satScale(loc.x);
|
|
306
|
+
lum = lumScale(loc.y);
|
|
307
|
+
|
|
308
|
+
slHandleElm
|
|
309
|
+
.style('display', null)
|
|
310
|
+
.style('top', `${lumScale.invert(lum)}px`)
|
|
311
|
+
.style('left', `${satScale.invert(sat)}px`)
|
|
312
|
+
.style('background-color', d3.hsl(hue, sat, lum));
|
|
313
|
+
if (!dontUpdateText){
|
|
314
|
+
// inputElm.attr('value', d3.hsl(hue, sat, lum));
|
|
315
|
+
inputElm.node().value = d3.hsl(hue, sat, lum);
|
|
316
|
+
// console.log(inputElm.attr('value'), inputElm.node().value);
|
|
317
|
+
// inputElm.node().setAttribute('value', inputElm.node().value);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
return picker;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return rainbow;
|
|
325
|
+
|
|
326
|
+
}));
|