-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gallery::Imagery Layers Split #5948
Changes from 3 commits
61bc547
25e9423
aecdc10
735f3a7
e957903
af804cc
76446d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
left: 50%; | ||
top: 0px; | ||
background-color: #D3D3D3; | ||
width: 2px; | ||
width: 5px; | ||
height: 100%; | ||
z-index: 9999; | ||
} | ||
|
@@ -68,27 +68,41 @@ | |
var slider = document.getElementById('slider'); | ||
viewer.scene.imagerySplitPosition = (slider.offsetLeft) / slider.parentElement.offsetWidth; | ||
|
||
var dragStartX = 0; | ||
var handler = new Cesium.ScreenSpaceEventHandler(slider); | ||
|
||
document.getElementById('slider').addEventListener('mousedown', mouseDown, false); | ||
window.addEventListener('mouseup', mouseUp, false); | ||
var bMoveActive = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please call this just |
||
|
||
function mouseUp() { | ||
window.removeEventListener('mousemove', sliderMove, true); | ||
} | ||
function move(movement){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting should be consistant with the rest of the code base. |
||
if(!bMoveActive){ | ||
return; | ||
} | ||
|
||
function mouseDown(e) { | ||
var slider = document.getElementById('slider'); | ||
dragStartX = e.clientX - slider.offsetLeft; | ||
window.addEventListener('mousemove', sliderMove, true); | ||
var nMove = movement.endPosition.x ;//- movement.startPosition.x; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the extra comment |
||
var splitPosition = (slider.offsetLeft + nMove) / slider.parentElement.offsetWidth; | ||
slider.style.left = 100.0 * splitPosition + "%"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use single quotes |
||
viewer.scene.imagerySplitPosition = splitPosition; | ||
} | ||
|
||
function sliderMove(e) { | ||
var slider = document.getElementById('slider'); | ||
var splitPosition = (e.clientX - dragStartX) / slider.parentElement.offsetWidth; | ||
slider.style.left = 100.0 * splitPosition + "%"; | ||
viewer.scene.imagerySplitPosition = splitPosition; | ||
} | ||
handler.setInputAction(function(movement) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to include the |
||
bMoveActive = true; | ||
}, Cesium.ScreenSpaceEventType.LEFT_DOWN); | ||
handler.setInputAction(function(movement) { | ||
bMoveActive = true; | ||
}, Cesium.ScreenSpaceEventType.PINCH_START); | ||
|
||
handler.setInputAction(function(movement) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be shoehorned to
|
||
move(movement); | ||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | ||
handler.setInputAction(function(movement) { | ||
move(movement); | ||
}, Cesium.ScreenSpaceEventType.PINCH_MOVE); | ||
|
||
handler.setInputAction(function(movement) { | ||
bMoveActive = false; | ||
}, Cesium.ScreenSpaceEventType.LEFT_UP); | ||
handler.setInputAction(function(movement) { | ||
bMoveActive = false; | ||
}, Cesium.ScreenSpaceEventType.PINCH_END); | ||
|
||
|
||
//Sandcastle_End | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really relevant to your changes, but can you add
infoBox: false
as an option when creating the viewer? It will keep the infobox from popping up without any information.