-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added add/remove spotlight functions
- Loading branch information
Showing
3 changed files
with
79 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,96 +9,27 @@ | |
integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw==" | ||
crossorigin=""/> | ||
<link rel="stylesheet" href="css/style.css"> | ||
<link rel="stylesheet" href="sidebar/css/leaflet-sidebar.min.css" /> | ||
|
||
<script | ||
src="https://code.jquery.com/jquery-3.2.1.min.js" | ||
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | ||
crossorigin="anonymous"></script> | ||
<!--<script--> | ||
<!--src="https://code.jquery.com/jquery-3.2.1.min.js"--> | ||
<!--integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="--> | ||
<!--crossorigin="anonymous"></script>--> | ||
|
||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" | ||
integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA==" | ||
crossorigin=""></script> | ||
<script src="lib/leaflet-src.js"></script> | ||
|
||
<script src="js/leaflet-spotlight-extension.js"></script> | ||
|
||
<script src='https://npmcdn.com/@turf/turf/turf.min.js'></script> | ||
<script src="data/points_5000.js"></script> | ||
|
||
<script src="sidebar/js/jquery-sidebar.min.js"></script> | ||
<script src="sidebar/js/leaflet-sidebar.min.js"></script> | ||
|
||
<script src="js/featureStyles.js"></script> | ||
<!--<script src="js/leaflet-spotlight.js"></script>--> | ||
<script src="js/init.js"></script> | ||
<!--<script src="js/initSimple.js"></script>--> | ||
<!--<script src="js/spotlightControl.js"></script>--> | ||
|
||
</head> | ||
<body> | ||
|
||
<div id="sidebar" class="sidebar collapsed"> | ||
<!-- Nav tabs --> | ||
<div class="sidebar-tabs"> | ||
<ul role="tablist"> | ||
<li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li> | ||
<li><a href="#profile" role="tab"><i class="fa fa-user"></i></a></li> | ||
<li class="disabled"><a href="#messages" role="tab"><i class="fa fa-envelope"></i></a></li> | ||
<li><a href="https://github.com/Turbo87/sidebar-v2" role="tab" target="_blank"><i class="fa fa-github"></i></a></li> | ||
</ul> | ||
|
||
<ul role="tablist"> | ||
<li><a href="#settings" role="tab"><i class="fa fa-gear"></i></a></li> | ||
</ul> | ||
</div> | ||
|
||
<!-- Tab panes --> | ||
<div class="sidebar-content"> | ||
<div class="sidebar-pane" id="home"> | ||
|
||
<h1 class="sidebar-header"> | ||
sidebar-v2 | ||
<span class="sidebar-close"><i class="fa fa-caret-left"></i></span> | ||
</h1> | ||
|
||
<fieldset> | ||
<label for="shape-selector">Spotlight shape: </label> | ||
<select name="Shape" id="shape-selector"> | ||
<option value="circle" selected="selected">Circle</option> | ||
<option value="rectangle">Rectangle</option> | ||
</select> | ||
<fieldset class="shape-params" id="circle-params"> | ||
<label for="circle-radius-input">Radius: </label> | ||
<input id="circle-radius-input" /> | ||
</fieldset> | ||
<fieldset class="shape-params" id="rectangle-params" style="display: none;"> | ||
<label for="rectangle-width-input">Width: </label> | ||
<input id="rectangle-width-input" /> | ||
<br> | ||
<label for="rectangle-height-input">Height: </label> | ||
<input id="rectangle-height-input" /> | ||
<br> | ||
<label for="rectangle-rotation-input">Rotation: </label> | ||
<input id="rectangle-rotation-input" /> | ||
</fieldset> | ||
</fieldset> | ||
|
||
</div> | ||
|
||
<div class="sidebar-pane" id="profile"> | ||
<h1 class="sidebar-header">Profile<span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> | ||
</div> | ||
|
||
<div class="sidebar-pane" id="messages"> | ||
<h1 class="sidebar-header">Messages<span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> | ||
</div> | ||
|
||
<div class="sidebar-pane" id="settings"> | ||
<h1 class="sidebar-header">Settings<span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="map"></div> | ||
<script src="js/init.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
var map; | ||
var spotlightShape; | ||
var sidebar; | ||
var pointLayer; | ||
// Initialize map & layers | ||
var map = L.map('map', {spotlight: true}).setView([50.1109, 8.6821], 15); | ||
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); | ||
|
||
$(document).ready(function() { | ||
var pointLayer = L.geoJSON(pointData, { | ||
|
||
// Initialize map & layers | ||
map = L.map('map', {spotlight: true}).setView([50.1109, 8.6821], 15); | ||
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); | ||
pointToLayer: function (feature, latlng) { | ||
return L.circleMarker(latlng, pointStyle); | ||
}, | ||
spotlight: true | ||
|
||
pointLayer = L.geoJSON(pointData, { | ||
pointToLayer: function (feature, latlng) { | ||
return L.circleMarker(latlng, pointStyle); | ||
} | ||
}).addTo(map); | ||
}); | ||
|
||
// Alternate method of enabling spotlight | ||
// map.spotlight.enable(); | ||
pointLayer.addTo(map) | ||
|
||
}); | ||
// Alternate method of enabling spotlight | ||
//map.spotlight.enable(); | ||
|
||
var mySpotlight = L.spotlight("aaa", { | ||
highlightStyle: 1, | ||
spotlightShape: 2, | ||
spotlightStyle: 3, | ||
targetLayer: 4 | ||
}); | ||
|
||
//var mySpotlight2 = new L.Spotlight("aaa", { | ||
// highlightStyle: 1, | ||
// spotlightShape: 2, | ||
// spotlightStyle: 3, | ||
// targetLayer: 4 | ||
//}); | ||
|
||
//map.addSpotlight(mySpotlight); | ||
|
||
mySpotlight.addTo(map); | ||
|
||
map.removeSpotlight(mySpotlight); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters