Permalink
Browse files

Map: Show balloons instead of hints on mobile devices (fix #51)

  • Loading branch information...
binarymaster committed Sep 6, 2018
1 parent 5a76111 commit 0e0f05355e68f23077e24d6ce2428cf2fc89d0fc
Showing with 13 additions and 7 deletions.
  1. +4 −2 3wifi.php
  2. +6 −4 map.html
  3. +3 −1 user.php
View
@@ -54,6 +54,7 @@
$callback = $_GET['callback'];
$clat = (float)$_GET['clat'];
$clon = (float)$_GET['clon'];
$mob = (isset($_GET['mobile']) ? (bool)$_GET['mobile'] : false);
$scat = (isset($_GET['scat']) ? (bool)$_GET['scat'] : false);
if (!db_connect())
@@ -108,7 +109,8 @@
$ap['options']['iconColor'] = '#FF1E1E';
}
$ap['properties']['hintContent'] = '';
$propContent = ($mob ? 'balloonContent' : 'hintContent');
$ap['properties'][$propContent] = '';
if (!empty($cluster['bssids']))
{
$hints = array();
@@ -138,7 +140,7 @@
$hints[] = implode('<br>', $aphint);
}
}
$ap['properties']['hintContent'] = implode('<hr>', $hints);
$ap['properties'][$propContent] = implode('<hr>', $hints);
}
$json['data']['features'][] = $ap;
}
View
@@ -17,23 +17,25 @@
var showaps = settingsGetBool('3wifi.map.showaps', true);
var clusters = settingsGetBool('3wifi.map.clusters', true);
var mob = isMobile();
if (mob) myTileUrl += '&mobile=1';
if (!clusters) myTileUrl += '&scat=1';
remoteObjectManager = new ymaps.RemoteObjectManager(myTileUrl,
{ // Разбивать запросы по тайлам
splitRequests: false,
// Опции кластеров задаются с префиксом cluster.
clusterHasBalloon: false,
clusterHasHint: true,
clusterHasHint: !mob,
// Опции объектов задаются с префиксом geoObject
geoObjectOpenBalloonOnClick: false
geoObjectOpenBalloonOnClick: mob
});
userLocations = new ymaps.RemoteObjectManager('user.php?a=mylocmap&bbox=%b',
userLocations = new ymaps.RemoteObjectManager('user.php?a=mylocmap&bbox=%b' + (mob ? '&mobile=1' : ''),
{ // Разбивать запросы по тайлам
splitRequests: false,
// Опции объектов задаются с префиксом geoObject
geoObjectOpenBalloonOnClick: false
geoObjectOpenBalloonOnClick: mob
});
if (ProfileInfo.Level >= 1)
View
@@ -592,6 +592,7 @@ function getFloatCoord($coord)
$lat2 = (float)$bbox[2];
$lon2 = (float)$bbox[3];
$callback = $_GET['callback'];
$mob = (isset($_GET['mobile']) ? (bool)$_GET['mobile'] : false);
$uid = $UserManager->uID;
if (!$res = QuerySql("SELECT latitude,longitude,comment FROM locations WHERE uid=$uid AND latitude BETWEEN $lat1 AND $lat2 AND longitude BETWEEN $lon1 AND $lon2"))
{
@@ -606,12 +607,13 @@ function getFloatCoord($coord)
$loc['type'] = 'Feature';
$loc['options']['iconColor'] = '#00D000';
$loc['geometry']['type'] = 'Point';
$propContent = ($mob ? 'balloonContent' : 'hintContent');
while ($row = $res->fetch_row())
{
$loc['geometry']['coordinates'][0] = (float)$row[0];
$loc['geometry']['coordinates'][1] = (float)$row[1];
$loc['id'] = 'loc'.substr(md5($row[0].$row[1]), 0, 4);
$loc['properties']['hintContent'] = '<b>Локация:</b><br>'.htmlspecialchars($row[2]);
$loc['properties'][$propContent] = '<b>Локация:</b><br>'.htmlspecialchars($row[2]);
$json['data']['features'][] = $loc;
}
$res->close();

0 comments on commit 0e0f053

Please sign in to comment.