Skip to content

Commit

Permalink
#452 Updated Identifier tool to be a separated floating tool
Browse files Browse the repository at this point in the history
- Need to test different UI combinations with other separated tools
- We may possibly want an option to make the tool not be separated to
maintain compatibility
  • Loading branch information
jtroberts committed Apr 19, 2024
1 parent f557a20 commit 859ed06
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
64 changes: 61 additions & 3 deletions src/essence/Tools/Identifier/IdentifierTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,32 @@ var IdentifierTool = {
MMWebGISInterface: null,
mousemoveTimeout: null,
mousemoveTimeoutMap: null,
targetId: null,
made: false,
justification: 'left',
vars: {},
make: function () {
initialize: function () {
//Get tool variables and UI adjustments
this.justification = L_.getToolVars('identifier')['justification']
var toolContent = d3.select('#toolSeparated_Identifier')
toolContent.style('bottom', '2px')
},
make: function (targetId) {
this.MMWebGISInterface = new interfaceWithMMWebGIS()
this.targetId = targetId
this.activeLayerNames = []

L_.subscribeOnLayerToggle('IdentifierTool', () => {
this.MMWebGISInterface = new interfaceWithMMWebGIS()
})

this.made = true

L_.subscribeOnLayerToggle('IdentifierTool', () => {
this.MMWebGISInterface = new interfaceWithMMWebGIS()
})

this.made = true

//Get tool variables
this.varsRaw = L_.getToolVars('identifier', true)
Expand Down Expand Up @@ -69,6 +92,9 @@ var IdentifierTool = {
},
destroy: function () {
this.MMWebGISInterface.separateFromMMWebGIS()
this.targetId = null
L_.unsubscribeOnLayerToggle('IdentifierTool')
this.made = false
},
fillURLParameters: function (url, layerUUID) {
if (IdentifierTool.vars.data?.[layerUUID]?.data?.[0]) {
Expand Down Expand Up @@ -441,7 +467,6 @@ function interfaceWithMMWebGIS() {
//tools.html( markup );

//Add event functions and whatnot
var previousCursor = d3.select('#map').style('cursor')
d3.select('#map').style('cursor', 'crosshair')

Map_.map.on('mousemove', IdentifierTool.idPixelMap)
Expand All @@ -456,10 +481,23 @@ function interfaceWithMMWebGIS() {

//Share everything. Don't take things that aren't yours.
// Put things back where you found them.

var newActive = $(
'#toolcontroller_sepdiv #' +
'Identifier' +
'Tool'
)
newActive.addClass('active').css({
color: ToolController_.activeColor,
})
newActive.parent().css({
background: ToolController_.activeBG,
})

function separateFromMMWebGIS() {
CursorInfo.hide()

d3.select('#map').style('cursor', previousCursor)
d3.select('#map').style('cursor', 'grab')

Map_.map.off('mousemove', IdentifierTool.idPixelMap)
//Globe_.shouldRaycastSprites = true
Expand All @@ -469,6 +507,26 @@ function interfaceWithMMWebGIS() {
.getContainer()
.removeEventListener('mousemove', IdentifierTool.idPixelGlobe)
}

let tools = d3.select(
IdentifierTool.targetId ? `#${IdentifierTool.targetId}` : '#toolPanel'
)
tools.style('background', 'var(--color-k)')
//Clear it
tools.selectAll('*').remove()

var prevActive = $(
'#toolcontroller_sepdiv #' +
'Identifier' +
'Tool'
)
prevActive.removeClass('active').css({
color: ToolController_.defaultColor,
background: 'none',
})
prevActive.parent().css({
background: 'none',
})
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/essence/Tools/Identifier/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
},
"hasVars": true,
"name": "Identifier",
"toolbarPriority": 1,
"separatedTool": true,
"paths": {
"IdentifierTool": "essence/Tools/Identifier/IdentifierTool"
}
Expand Down

0 comments on commit 859ed06

Please sign in to comment.