New Tooltip interface

This commit is contained in:
2021-06-13 14:00:12 +02:00
parent 7240b766f9
commit c98abaaff6
6 changed files with 127 additions and 110 deletions

View File

@@ -608,7 +608,18 @@ class Spot extends Main
//Seconds //Seconds
$fSecond = round($dLeft * 3600, 1); $fSecond = round($dLeft * 3600, 1);
return $iDegree.'°'.$iMinute."'".$fSecond.'"'.$sDirection; return
$iDegree.'°'.
self::getNumberWithLeadingZeros($iMinute, 2, 0)."'".
self::getNumberWithLeadingZeros($fSecond, 2, 1).'"'.
$sDirection;
}
public static function getNumberWithLeadingZeros($fValue, $iNbLeadingZeros, $iNbDigits){
$sDecimalSeparator = ".";
if($iNbDigits > 0) $iNbLeadingZeros += mb_strlen($sDecimalSeparator) + $iNbDigits;
$sPattern = '%0'.$iNbLeadingZeros.$sDecimalSeparator.$iNbDigits.'f';
return sprintf($sPattern, $fValue);
} }
public function getTimeFormat($iTime, $sTimeZone='') { public function getTimeFormat($iTime, $sTimeZone='') {

View File

@@ -411,8 +411,8 @@ function initSpotMessages(aoMessages, aoTracks) {
//Controls: Elevation //Controls: Elevation
if(!isMobile()) { if(!isMobile()) {
var aoElevTracks = {type: 'FeatureCollection', features:[], properties: {summary: 'Elevation'}}; var aoElevTracks = {type: 'FeatureCollection', features:[], properties: {summary: 'trackType'}};
var aoLegend = {Elevation: {}}; var aoLegend = {trackType: {}};
for(var i in aoTracks.features) { for(var i in aoTracks.features) {
if(aoTracks.features[i].properties.type != 'hitchhiking') { if(aoTracks.features[i].properties.type != 'hitchhiking') {
//Feature //Feature
@@ -422,7 +422,7 @@ function initSpotMessages(aoMessages, aoTracks) {
aoElevTracks.features.push(oTrack); aoElevTracks.features.push(oTrack);
//Legend //Legend
aoLegend.Elevation[sType] = {text: oSpot.lang('track_'+sType), color: self.tmp(['track-type-styles', sType, 'color'])}; aoLegend.trackType[sType] = {text: oSpot.lang('track_'+sType), color: self.tmp(['track-type-styles', sType, 'color'])};
} }
} }
var oElev = L.control.heightgraph({ var oElev = L.control.heightgraph({
@@ -476,7 +476,10 @@ function initSpotMessages(aoMessages, aoTracks) {
onEachFeature: function(feature, oLayer) { onEachFeature: function(feature, oLayer) {
var asProperties = feature.properties; var asProperties = feature.properties;
var $Tooltip = $('<div>', {'class':'track_tooltip'}); var $Tooltip = $('<div>', {'class':'track_tooltip'});
$('<p>', {'class':'name', 'title':asProperties.name}).addIcon('fa-track-'+asProperties.type+' fa-fw', true).append(asProperties.name).appendTo($Tooltip); $('<h1>', {'title':asProperties.name})
.addIcon('fa-track-'+asProperties.type+' fa-fw', true)
.append(asProperties.name)
.appendTo($Tooltip);
var $TooltipDetails = $('<div>', {'class':'details'}); var $TooltipDetails = $('<div>', {'class':'details'});
if(asProperties.Name != asProperties.description && asProperties.description != '') { if(asProperties.Name != asProperties.description && asProperties.description != '') {
@@ -567,6 +570,7 @@ function initSpotMessages(aoMessages, aoTracks) {
else oMap.fitBounds(self.tmp('track').getBounds(), {paddingTopLeft: L.point(5, self.tmp('marker_size').height + 5), paddingBottomRight: L.point(5 + iPanelWidth, 5)}); else oMap.fitBounds(self.tmp('track').getBounds(), {paddingTopLeft: L.point(5, self.tmp('marker_size').height + 5), paddingBottomRight: L.point(5 + iPanelWidth, 5)});
//Spot Messages //Spot Messages
var iWorkSpaceMinWidth = self.tmp('$Projects').width() - self.tmp('$Feed').outerWidth(true) - self.tmp('$Settings').outerWidth(true);
$.each(aoMessages, function(iKey, oMsg){ $.each(aoMessages, function(iKey, oMsg){
//Marker //Marker
@@ -579,13 +583,16 @@ function initSpotMessages(aoMessages, aoTracks) {
//Tooltip //Tooltip
$Tooltip = $('<div>', {'class':'info-window'}) $Tooltip = $('<div>', {'class':'info-window'})
.append($('<h1>') .append($('<h1>')
.addIcon('fa-message fa-fw fa-lg') .addIcon('fa-message fa-lg push')
.append('Message '+oMsg.type+' '+oSpot.lang('counter', oMsg.displayed_id))) .append($('<span>').text('Message '+oSpot.lang('counter', oMsg.displayed_id)))
.append($('<span>', {'class':'message-type'}).text('('+oMsg.type+')'))
)
.append($('<div>', {'class':'separator'}))
.append($('<p>', {'class':'coordinates'}) .append($('<p>', {'class':'coordinates'})
.addIcon('fa-coords fa-fw fa-lg', false) .addIcon('fa-coords fa-fw fa-lg', true)
.append(getGoogleMapsLink(oMsg))) .append(getGoogleMapsLink(oMsg)))
.append($('<p>', {'class':'time'}) .append($('<p>', {'class':'time'})
.addIcon('fa-time fa-fw fa-lg') .addIcon('fa-time fa-fw fa-lg', true)
.append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':''))); .append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':'')));
//Tooltip: Time Zone //Tooltip: Time Zone
@@ -601,13 +608,11 @@ function initSpotMessages(aoMessages, aoTracks) {
$.each(oMsg.medias, function(iKey, asMedia) { $.each(oMsg.medias, function(iKey, asMedia) {
$Medias.append(getMediaLink(asMedia, 'marker')); $Medias.append(getMediaLink(asMedia, 'marker'));
}); });
$Tooltip $Tooltip.append($Medias);
.append($('<p>').addIcon('fa-media fa-fw fa-lg').append(oSpot.lang('images')))
.append($Medias);
} }
oMarker.bindPopup($Tooltip[0], { oMarker.bindPopup($Tooltip[0], {
maxWidth: self.tmp('$Projects').width(), maxWidth: iWorkSpaceMinWidth,
autoPan: false, autoPan: false,
closeOnClick: true, closeOnClick: true,
offset: new L.Point(0, -30) offset: new L.Point(0, -30)

View File

@@ -20,9 +20,12 @@ $stroke-width-axis : 2;
.leaflet-popup { .leaflet-popup {
.leaflet-popup-content-wrapper { .leaflet-popup-content-wrapper {
border-radius: 5px; border-radius: 5px;
padding: 0;
.leaflet-popup-content { .leaflet-popup-content {
margin: 1rem; margin: 0;
padding: 1rem;
box-sizing: border-box;
} }
} }
} }

View File

@@ -1,4 +1,5 @@
//Feed width //Feed width
$elem-spacing: 0.5rem;
$block-spacing: 1rem; $block-spacing: 1rem;
$panel-width: 30%; $panel-width: 30%;
$panel-width-max: "400px + 3 * #{$block-spacing}"; $panel-width-max: "400px + 3 * #{$block-spacing}";
@@ -110,39 +111,104 @@ $legend-color: $post-color;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
.track_tooltip { /* Leaflet Popup */
p { .leaflet-popup-content {
h1 {
font-size: 1.4em;
margin: 0; margin: 0;
font-weight: bold;
&.name {
font-weight: bold;
font-size: 1.4em;
}
&.description {
font-size: 1.15em;
}
&.detail {
margin-top: 1em;
width: 50%;
display: inline-block;
}
}
.name, .description {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
} }
.separator { .separator {
border-top: 1px solid #CCC; border-top: 1px solid #CCC;
margin-top: calc(1em/1.4); margin: $elem-spacing 0 $block-spacing 0;
} }
.details { /* Marker Popup */
padding-left: calc(1.25em*1.4 + 0.5rem); .info-window {
h1 .message-type {
color: #CCC;
font-weight: normal;
font-size: calc(1em / 1.4);
margin-left: 0.5em;
vertical-align: text-bottom;
}
p {
font-size: 1.0em;
margin: $elem-spacing 0 0 0;
a {
color: $post-color;
}
}
.medias {
line-height: 0;
a {
display: inline-block;
margin: $block-spacing $block-spacing 0 0;
&:last-child {
margin-right: 0;
}
&.drill {
font-size: 2em;
.fa-drill-image {
color: transparent;
}
.fa-drill-video {
color: rgba(255, 255, 255, 0.5);
}
&:hover {
.fa-drill-video, .fa-drill-image {
color: rgba(255, 255, 255, 0.75);
}
}
}
img {
max-width: 200px;
max-height: 100px;
border-radius: 3px;
image-orientation: from-image;
transition: All 0.2s;
}
}
}
}
/* Track Popup */
.track_tooltip {
p {
margin: 0;
&.description {
font-size: 1.15em;
}
}
h1, .description {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.details {
margin-top: -$block-spacing;
padding-left: calc(1.25em*1.4 + #{$elem-spacing} );
p.detail {
margin-top: $block-spacing;
width: 50%;
display: inline-block;
}
}
} }
} }
} }
@@ -696,74 +762,6 @@ $legend-color: $post-color;
} }
} }
} }
/* Info Window */
.leaflet-popup-content {
.info-window {
h1 {
font-size: 1.2em;
margin: 1em 0 1.2em;
i {
margin-right: 0.3125em;
}
}
p {
font-size: 1.0em;
margin: 0.5em 0 0 0;
i {
padding-right: 0.5em;
}
a {
color: $post-color;
}
}
.medias {
margin-top: -0.5rem;
line-height: 0;
a {
display: inline-block;
margin-right: $block-spacing;
margin-top: $block-spacing;
&:last-child {
margin-right: 0;
}
&.drill {
font-size: 2em;
.fa-drill-image {
color: transparent;
}
.fa-drill-video {
color: rgba(255, 255, 255, 0.5);
}
&:hover {
.fa-drill-video, .fa-drill-image {
color: rgba(255, 255, 255, 0.75);
}
}
}
img {
max-width: 200px;
max-height: 100px;
border-radius: 3px;
image-orientation: from-image;
transition: All 0.2s;
}
}
}
}
}
} }
#elems { #elems {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long