slider moves with arrow clicks: $scope.$broadcast('rzSliderForceRender');
slider skip will continue to final chapter map pans when character is enabled close buttons in all headers towns added to search results search results are clickable edited about text
This commit is contained in:
+80
-5
@@ -52,6 +52,7 @@ angular.module('quartermaester')
|
||||
$scope.toState = toState;
|
||||
$scope.slideTo = slideTo;
|
||||
$scope.panTo = panTo;
|
||||
$scope.resultClick = resultClick;
|
||||
$scope.refreshMap = refreshMap;
|
||||
$scope.locationDetail = null;
|
||||
|
||||
@@ -74,6 +75,7 @@ angular.module('quartermaester')
|
||||
|
||||
$scope.$watch('slider', refreshMap, true);
|
||||
$scope.$watch('options', refreshMap, true);
|
||||
$scope.$watch('options.characters', panToCharacter, true);
|
||||
|
||||
for (var i=0;i<qmData.characters.length; i++) {
|
||||
$scope.options.characters[qmData.characters[i].key] = false;
|
||||
@@ -89,16 +91,30 @@ angular.module('quartermaester')
|
||||
$scope.mapModels.characters = $filter('qmSlider')(qmData.characterMarkers, $scope.slider, $scope.options);
|
||||
$scope.mapModels.paths = $filter('qmSlider')(qmData.characterPaths, $scope.slider, $scope.options);
|
||||
//console.log("mapModels.paths", $scope.mapModels.paths);
|
||||
}
|
||||
|
||||
function panToCharacter(newValue, oldValue) {
|
||||
for (var character in newValue) {
|
||||
if (newValue[character] && !oldValue[character]) {
|
||||
var characterMarkers = $filter('filter')($scope.mapModels.characters, {character: {key: character}});
|
||||
if (characterMarkers.length==0) return false;
|
||||
|
||||
var coords = characterMarkers[characterMarkers.length-1].coords
|
||||
$scope.map.control.getGMap().panTo({lat: coords.latitude, lng: coords.longitude});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toState(stateName) {
|
||||
$scope.state = stateName;
|
||||
if (stateName=="search")
|
||||
$timeout(function() {
|
||||
document.getElementById("searchInput").focus();
|
||||
});
|
||||
if (stateName=="search") $timeout(function() {
|
||||
document.getElementById("searchInput").focus();
|
||||
});
|
||||
// if (stateName=="slider-full") $timeout(function() {
|
||||
// console.log(document.getElementById("slide-"+$scope.slider.show).getElementsByClassName("rz-pointer"));
|
||||
// document.getElementById("slide-"+$scope.slider.show).getElementsByClassName("rz-pointer")[0].focus();
|
||||
// });
|
||||
}
|
||||
|
||||
function slideTo(input) {
|
||||
@@ -128,6 +144,10 @@ angular.module('quartermaester')
|
||||
if ($scope.slider[measure]==sliderMax) break;
|
||||
if ($scope.slider.show=="episodes") $scope.slider[measure] = Math.min(sliderMax, Math.ceil(($scope.slider[measure]+2)/10)*10-1);
|
||||
else {
|
||||
if ($scope.slider[measure] >= 270) {
|
||||
$scope.slider[measure] = 344;
|
||||
break;
|
||||
}
|
||||
for (var bookId=0; bookId<=4; bookId++) {
|
||||
var epilogue = parseInt(qmData.books[bookId].precedingChapters, 10)-1;
|
||||
if (epilogue < $scope.slider[measure]+1) continue;
|
||||
@@ -153,7 +173,7 @@ angular.module('quartermaester')
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$scope.$broadcast('rzSliderForceRender');
|
||||
}
|
||||
|
||||
function panTo(input) {
|
||||
@@ -165,6 +185,61 @@ angular.module('quartermaester')
|
||||
$scope.state = "location";
|
||||
}
|
||||
|
||||
function resultClick(model) {
|
||||
switch (model.icon) {
|
||||
case "glyphicon-map-marker":
|
||||
var town = $filter('filter')($scope.mapModels.towns, {key: model.key})[0];
|
||||
$scope.map.control.getGMap().panTo({lat: town.coords.latitude, lng: town.coords.longitude});
|
||||
$scope.locationDetail = town;
|
||||
$scope.state = "location";
|
||||
break;
|
||||
|
||||
case "glyphicon-user":
|
||||
$scope.options.characters[model.key] = true;
|
||||
var character = $filter('filter')($scope.characters, {key: model.key})[0];
|
||||
var allCharacterMarkers = $filter('qmSlider')(qmData.characterMarkers, $scope.slider, $scope.options);
|
||||
var matchedCharacterMarkers = $filter('filter')(allCharacterMarkers, {character: {key: model.key}});
|
||||
$scope.locationDetail = {
|
||||
name: "",
|
||||
url: "",
|
||||
house: character.name,
|
||||
houseImg: character.house.img,
|
||||
houseUrl: character.url,
|
||||
direct: "#"
|
||||
};
|
||||
$scope.state = "location";
|
||||
if (matchedCharacterMarkers.length==0) break;
|
||||
var thisCharacterMarker = matchedCharacterMarkers[0];
|
||||
$scope.map.control.getGMap().panTo({lat: thisCharacterMarker.coords.latitude, lng: thisCharacterMarker.coords.longitude});
|
||||
$scope.locationDetail.name = thisCharacterMarker.town.name;
|
||||
$scope.locationDetail.url = thisCharacterMarker.town.url;
|
||||
$scope.locationDetail.direct = ($scope.slider.show=="episodes") ? thisCharacterMarker.episode.url : thisCharacterMarker.chapter.url;
|
||||
break;
|
||||
|
||||
case "glyphicon-home":
|
||||
var house = $filter('filter')(qmData.heraldry, {seat: model.subtitle})[0];
|
||||
$scope.map.control.getGMap().panTo({lat: house.coords.latitude, lng: house.coords.longitude});
|
||||
$scope.locationDetail = {
|
||||
name: house.seat,
|
||||
url: house.seatUrl,
|
||||
house: house.name,
|
||||
houseImg: house.houseImg,
|
||||
houseUrl: house.url,
|
||||
direct: house.direct
|
||||
};
|
||||
$scope.state = "location";
|
||||
break;
|
||||
|
||||
case "glyphicon-facetime-video":
|
||||
case "glyphicon-book":
|
||||
slideTo(model.abbr);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log("resultClick", model);
|
||||
}
|
||||
}
|
||||
|
||||
function locationClick(marker, eventName, model) {
|
||||
$scope.locationDetail = model;
|
||||
$scope.state = "location";
|
||||
|
||||
+8
-9
@@ -138,7 +138,7 @@ angular.module('quartermaester')
|
||||
icon: "glyphicon-facetime-video",
|
||||
title: episode.title,
|
||||
subtitle: "HBO episode",
|
||||
abbr: "S" + episode.season + "E" + epNumber + ": " + episode.title,
|
||||
abbr: "S" + episode.season + "E" + epNumber,
|
||||
click: function(){slideTo(this.abbr)}
|
||||
};
|
||||
}
|
||||
@@ -213,6 +213,7 @@ angular.module('quartermaester')
|
||||
longitude: parseFloat(town.longitude)
|
||||
},
|
||||
options: {
|
||||
// zindex: 2, // bug prevents this form working
|
||||
icon: {path: 0, strokeOpacity: 0, scale: 3}
|
||||
}
|
||||
});
|
||||
@@ -228,9 +229,8 @@ angular.module('quartermaester')
|
||||
return {
|
||||
icon: "glyphicon-map-marker",
|
||||
key: town.key,
|
||||
title: town.name,
|
||||
subtitle: town.region.replace(/_/g," "),
|
||||
click: function(){panTo(this.key)}
|
||||
title: decodeURI(town.key).replace(/_/g," "),
|
||||
subtitle: town.region.replace(/_/g," ")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -255,8 +255,7 @@ angular.module('quartermaester')
|
||||
icon: "glyphicon-user",
|
||||
key: character.key,
|
||||
title: character.name,
|
||||
subtitle: "", //decodeURI(character.house).replace(/_/g," "),
|
||||
click: function(){showCharacter(this.key)}
|
||||
subtitle: "", //decodeURI(character.house).replace(/_/g," ")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -292,6 +291,7 @@ angular.module('quartermaester')
|
||||
direct: "#@" + house.seatKey,
|
||||
coords: coords,
|
||||
options: {
|
||||
// zindex: 1, // bug prevents this form working
|
||||
icon: {
|
||||
url: house.img,
|
||||
scaledSize: house.isGreat ? {height:60, width:50} : {height:30, width:25},
|
||||
@@ -305,8 +305,7 @@ angular.module('quartermaester')
|
||||
return {
|
||||
icon: "glyphicon-home",
|
||||
title: decodeURI(house.wikiKey).replace(/_/g," "),
|
||||
subtitle: (house.seatKey=="") ? house.clue : decodeURI(house.seatKey).replace(/_/g," "),
|
||||
click: function(){showCharacter(character.key)}
|
||||
subtitle: (house.seatKey=="") ? house.clue : decodeURI(house.seatKey).replace(/_/g," ")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -486,7 +485,7 @@ angular.module('quartermaester')
|
||||
// var listHeight = attrs.qmList ? 41*parseInt(attrs.qmList, 10) : 0;
|
||||
// console.log(winHeight, attrs.qmList, listHeight);
|
||||
// if (listHeight>winHeight) elem.css('height', winHeight - 48 + 'px');
|
||||
elem.css('height', winHeight - 50 + 'px');
|
||||
elem.css('height', winHeight - 55 + 'px');
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user