Skip to content

Commit 61c408f

Browse files
committed
print update
1 parent 120f3e5 commit 61c408f

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

js/print.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ var bfl_options = {
111111
// opacity: 1
112112
// };
113113
}, // Overwrite the default BFL GeoJSON style function
114-
onEachFeature: () => {
114+
onEachFeature: (feature, layer) => {
115115
console.log('hello');
116116
}, // Overwrite the default BFL GeoJSON onEachFeature function
117117
layer: shapeLayer, // If you want a custom layer to be used (must be a GeoJSON class inheritance)
@@ -124,14 +124,24 @@ var bfl_options = {
124124
}
125125
L.Control.betterFileLayer(bfl_options).addTo(map);
126126

127+
map.on("bfl:layerloaded", (ev) => {
128+
console.log("Your file was read successfully!! Event: ", ev);
129+
shapeLayer.eachLayer(r => {
130+
r.setStyle({
131+
opacity: $('#slider2').val()/100,
132+
fillOpacity: $('#slider1').val()/100,
133+
});
134+
});
135+
});
136+
127137
// ###############################################33
128138
function changeDimensions(reset=false, preset=false) {
129-
console.log("changing dimensions");
139+
// console.log("changing dimensions");
130140
// console.log("chosen preset: " + $('#presets').val(), reset, preset);
131141
var w;
132142
var h;
133143
if(reset) {
134-
console.log("resetting");
144+
// console.log("resetting");
135145
$(`.width`).val(ORIG_W);
136146
$(`.height`).val(ORIG_H);
137147
w = ORIG_W;
@@ -207,9 +217,6 @@ function zoomFit(){
207217
map.fitBounds(shapeLayer.getBounds(), {padding:[5,5], maxZoom:17});
208218
}
209219

210-
// Range slider, from https://www.w3schools.com/howto/howto_js_rangeslider.asp
211-
document.getElementById("slider1").value = 60;
212-
document.getElementById("slider2").value = 60;
213220

214221
document.getElementById("slider1").oninput = function() {
215222
shapeLayer.eachLayer(r => {

print.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ <h3>Transparency</h3>
140140
<button onclick="changeColor()">Apply</button>
141141
<br>[Under Construction]
142142
</p> -->
143-
Fill Opacity: <div class="slidecontainer"><input type="range" min="1" max="100" value="50" class="slider" id="slider1"></div>
144-
Border Opacity: <div class="slidecontainer"><input type="range" min="1" max="100" value="50" class="slider" id="slider2"></div>
143+
Border Opacity: <div class="slidecontainer"><input type="range" min="0" max="100" value="100" class="slider" id="slider2"></div>
144+
Fill Opacity: <div class="slidecontainer"><input type="range" min="0" max="100" value="0" class="slider" id="slider1"></div>
145145
Map Opacity: <div class="slidecontainer"><input type="range" min="1" max="100" value="100" class="slider" id="slider3"></div>
146146
Change the backround layer with the layer picker over the map.
147147
</div>

0 commit comments

Comments
 (0)