Skip to content

Commit

Permalink
Merge b0537e6 into 78e7c80
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlarson committed Jul 31, 2018
2 parents 78e7c80 + b0537e6 commit 4588822
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 663 deletions.
13 changes: 6 additions & 7 deletions app/assets/javascripts/geoblacklight/modules/layer_opacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// check if layer is actually a layer group
if (typeof layer.getLayers !== 'undefined') {

// add first layer from layer group to options
// add first layer from layer group to options
options.layer = layer.getLayers()[0];
} else {

Expand All @@ -30,7 +30,9 @@
handleArrowDown = L.DomUtil.create('div', 'opacity-arrow-down', handle),
bottom = L.DomUtil.create('div', 'opacity-bottom', container);

L.DomEvent.stopPropagation(container);
L.DomEvent.disableClickPropagation(container);

this.setListeners(handle, bottom, handleText);
handle.style.top = handle.offsetTop - 13 + 50 + 'px';
handleText.innerHTML = parseInt(this.options.layer.options.opacity * 100) + '%';
Expand All @@ -42,7 +44,7 @@
start = false,
startTop;

L.DomEvent.addListener(document, 'mousemove', function(e) {
L.DomEvent.on(document, 'mousemove', function(e) {
if (!start) return;
var percentInverse = Math.max(0, Math.min(200, startTop + parseInt(e.clientY, 10) - start)) / 2;
handle.style.top = ((percentInverse * 2) - 13) + 'px';
Expand All @@ -52,16 +54,13 @@
_this.options.layer.setOpacity(1 - (percentInverse / 100));
});

L.DomEvent.addListener(handle, 'mousedown', function(e) {
L.DomEvent.disableClickPropagation(e);
L.DomEvent.on(handle, 'mousedown', function(e) {
start = parseInt(e.clientY, 10);
startTop = handle.offsetTop - 12;
return false;
});

L.DomEvent.addListener(document, 'mouseup', function(e) {
L.DomEvent.stopPropagation(e);
L.DomEvent.disableClickPropagation(e);
L.DomEvent.on(document, 'mouseup', function(e) {
start = null;
});
}
Expand Down
6 changes: 2 additions & 4 deletions app/assets/javascripts/geoblacklight/viewers/esri.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ GeoBlacklight.Viewer.Esri = GeoBlacklight.Viewer.Map.extend({

// remove any trailing slash from endpoint url
_this.data.url = _this.data.url.replace(/\/$/, '');

L.esri.get = L.esri.Request.get.JSONP;
L.esri.get(_this.data.url, {}, function(error, response){
if(!error) {
_this.layerInfo = response;
Expand All @@ -47,7 +45,7 @@ GeoBlacklight.Viewer.Esri = GeoBlacklight.Viewer.Map.extend({
return true;
}
},

// clear attribute table and setup spinner icon
appendLoadingMessage: function() {
var spinner = '<tbody class="attribute-table-body"><tr><td colspan="2">' +
Expand All @@ -61,7 +59,7 @@ GeoBlacklight.Viewer.Esri = GeoBlacklight.Viewer.Map.extend({

// appends error message to attribute table
appendErrorMessage: function() {
$('.attribute-table-body').html('<tbody class="attribute-table-body">'+
$('.attribute-table-body').html('<tbody class="attribute-table-body">'+
'<tr><td colspan="2">Could not find that feature</td></tr></tbody>');
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ GeoBlacklight.Viewer.DynamicMapLayer = GeoBlacklight.Viewer.Esri.extend({
this.dynamicLayerId = lastSegment;
this.data.url = this.data.url.slice(0,-(lastSegment.length + 1));
}
L.esri.get = L.esri.Request.get.JSONP;

// L.esri.get = L.esri.Request.get.JSONP;
L.esri.get(_this.data.url, {}, function(error, response){
if(!error) {
_this.layerInfo = response;
Expand Down Expand Up @@ -54,13 +54,13 @@ GeoBlacklight.Viewer.DynamicMapLayer = GeoBlacklight.Viewer.Esri.extend({
return esriDynamicMapLayer;
},

setupInspection: function(layer) {
setupInspection: function(layer) {
var _this = this;
this.map.on('click', function(e) {
_this.appendLoadingMessage();

// query layer at click location
var identify = L.esri.Tasks.identifyFeatures({
var identify = L.esri.identifyFeatures({
url: layer.options.url,
useCors: true
})
Expand Down
6 changes: 2 additions & 4 deletions app/assets/javascripts/geoblacklight/viewers/index_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GeoBlacklight.Viewer.IndexMap = GeoBlacklight.Viewer.Map.extend({
load: function() {
this.map = L.map(this.element).fitBounds(this.options.bbox);
this.map.addLayer(this.selectBasemap());

if (this.data.available) {
this.addPreviewLayer();
} else {
Expand Down Expand Up @@ -40,9 +40,7 @@ GeoBlacklight.Viewer.IndexMap = GeoBlacklight.Viewer.Map.extend({
onEachFeature: function(feature, layer) {
// Add a hover label for the label property
if (feature.properties.label !== null) {
layer.bindLabel(feature.properties.label, {
direction: 'auto', permanent: true
});
layer.bindTooltip(feature.properties.label);
}
// If it is available add clickable info
if (feature.properties.available !== null) {
Expand Down
2 changes: 1 addition & 1 deletion geoblacklight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'rails', '~> 5.0'
spec.add_dependency 'blacklight', '7.0.0.rc1'
spec.add_dependency 'leaflet-rails', '~> 0.7.3'
spec.add_dependency 'leaflet-rails', '~> 1.3.0'
spec.add_dependency 'font-awesome-rails', '~> 4.7'
spec.add_dependency 'config'
spec.add_dependency 'faraday'
Expand Down
1 change: 0 additions & 1 deletion lib/generators/geoblacklight/templates/geoblacklight.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
//= require leaflet-iiif
//= require esri-leaflet
//= require readmore.min
//= require leaflet-label-src
28 changes: 4 additions & 24 deletions vendor/assets/javascripts/esri-leaflet.js

Large diffs are not rendered by default.

0 comments on commit 4588822

Please sign in to comment.