Commit 8a21c4c4 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. fixed marker deleting bug 2. fixed map.html 3. fixed 3d distance not in sync in 2 message divs

parent 00cb5a2a
...@@ -46,6 +46,13 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){ ...@@ -46,6 +46,13 @@ function x3dom_getXYPosOr(cnvx,cnvy,round){
var index = Scene.highlighted_marker_index; var index = Scene.highlighted_marker_index;
if (index==null){
if ((Scene.draggedTransformNode!=undefined)&&(Scene.draggedTransformNode!=null)){
var sphere = Scene.draggedTransformNode.parent().parent();
index = parseInt(sphere.attr("id").substr(7));
}
}
if ((index==null)||(Data.markers[index]==undefined)){ if ((index==null)||(Data.markers[index]==undefined)){
x = shootRay.pickPosition.x; x = shootRay.pickPosition.x;
......
...@@ -575,11 +575,14 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -575,11 +575,14 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
var self = this; var self = this;
var marker = this._shape; var marker = this._shape;
var id_prefix = $(this._elem).attr("id").substr(0,PREFIX.length); //var id_prefix = $(this._elem).attr("id").substr(0,PREFIX.length);
var index = parseInt($(this._elem).attr("id").substr(PREFIX.length)); //var index = parseInt($(this._elem).attr("id").substr(PREFIX.length));
marker.on('click',function(e){ marker.on('click',function(e){
var elem = $(this).parent().parent().parent();
var index = parseInt($(elem).attr("id").substr(PREFIX.length));
var id_prefix = $(elem).attr("id").substr(0,PREFIX.length);
//self.dehighlight(); //self.dehighlight();
//X3DOMObject.PointerMarker.dehighlight(self._elem); //X3DOMObject.PointerMarker.dehighlight(self._elem);
...@@ -587,10 +590,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -587,10 +590,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
if (id_prefix==PREFIX){ if (id_prefix==PREFIX){
self._elem.remove(); elem.remove();
// REMOVE // REMOVE
Data.markers.splice(index); Data.markers.splice(index,1);
Scene.updateMarkersIndices(); Scene.updateMarkersIndices();
Map.deleteMarker(index); Map.deleteMarker(index);
...@@ -599,7 +602,7 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -599,7 +602,7 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
}else{ }else{
X3DOMObject.Marker.toggle(self._elem); X3DOMObject.Marker.toggle(elem);
Map.toggleMarker(index); Map.toggleMarker(index);
} }
...@@ -608,8 +611,13 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -608,8 +611,13 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
marker.on('mouseover',function(e){ marker.on('mouseover',function(e){
X3DOMObject.Marker.highlight(self._elem); var elem = $(this).parent().parent().parent();
var index = parseInt($(elem).attr("id").substr(PREFIX.length));
var id_prefix = $(elem).attr("id").substr(0,PREFIX.length);
X3DOMObject.Marker.highlight(elem);
Map.highlightMarker(index); Map.highlightMarker(index);
Scene.highlighted_marker_index = index; Scene.highlighted_marker_index = index;
if (Scene._ctrlKey){ if (Scene._ctrlKey){
...@@ -630,16 +638,19 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -630,16 +638,19 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
marker.on('mouseout',function(e){ marker.on('mouseout',function(e){
var elem = $(this).parent().parent().parent();
var index = parseInt($(elem).attr("id").substr(PREFIX.length));
//self.highlightMarker(index); //self.highlightMarker(index);
Scene.highlighted_marker_index = null; Scene.highlighted_marker_index = null;
if (Scene.draggedTransformNode==null){ if (Scene.draggedTransformNode==null){
if (!self._elem.prop("selected")){ if (!elem.prop("selected")){
X3DOMObject.Marker.dehighlight(self._elem); X3DOMObject.Marker.dehighlight(elem);
Map.dehighlightMarker(index); Map.dehighlightMarker(index);
}else{ }else{
X3DOMObject.Marker.highlight(self._elem); X3DOMObject.Marker.highlight(elem);
Map.highlightMarker(index); Map.highlightMarker(index);
} }
...@@ -649,7 +660,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -649,7 +660,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
marker.on('mousedown',function(e){ marker.on('mousedown',function(e){
X3DOMObject.Marker.dehighlight(self._elem); var elem = $(this).parent().parent().parent();
var index = parseInt($(elem).attr("id").substr(PREFIX.length));
X3DOMObject.Marker.dehighlight(elem);
Map.dehighlightMarker(index); Map.dehighlightMarker(index);
document.getElementById("navInfo").setAttribute("type", '"NONE"'); document.getElementById("navInfo").setAttribute("type", '"NONE"');
...@@ -666,7 +680,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){ ...@@ -666,7 +680,10 @@ X3DOMObject.Marker.prototype._registerEvents = function(){
marker.on('mouseup',function(e){ marker.on('mouseup',function(e){
X3DOMObject.Marker.highlight(self._elem); var elem = $(this).parent().parent().parent();
var index = parseInt($(elem).attr("id").substr(PREFIX.length));
X3DOMObject.Marker.highlight(elem);
Map.highlightMarker(index); Map.highlightMarker(index);
}); });
...@@ -762,6 +779,7 @@ X3DOMObject.Marker.mouseMove = function(event){ ...@@ -762,6 +779,7 @@ X3DOMObject.Marker.mouseMove = function(event){
if (!$(sr.pickObject).hasClass("shapemarker")){ if (!$(sr.pickObject).hasClass("shapemarker")){
var sphere = Scene.draggedTransformNode.parent().parent(); var sphere = Scene.draggedTransformNode.parent().parent();
var index = parseInt(sphere.attr("id").substr(7)); var index = parseInt(sphere.attr("id").substr(7));
X3DOMObject.Marker.place(sr.pickPosition.x,sr.pickPosition.y,sr.pickPosition.z,"my-sph-"+index); X3DOMObject.Marker.place(sr.pickPosition.x,sr.pickPosition.y,sr.pickPosition.z,"my-sph-"+index);
//console.log("got shape"); //console.log("got shape");
//Scene.draggedTransformNode //Scene.draggedTransformNode
...@@ -943,6 +961,8 @@ X3DOMObject.MapMarker.registerEvents = function(map_mark){ ...@@ -943,6 +961,8 @@ X3DOMObject.MapMarker.registerEvents = function(map_mark){
map_mark.on('mouseover',function(){ map_mark.on('mouseover',function(){
//console.log(this._index);
var index = this._index; var index = this._index;
var elem = $("#my-sph-"+index); var elem = $("#my-sph-"+index);
...@@ -1027,7 +1047,10 @@ X3DOMObject.MapMarker.registerEvents = function(map_mark){ ...@@ -1027,7 +1047,10 @@ X3DOMObject.MapMarker.registerEvents = function(map_mark){
*/ */
X3DOMObject.displayInfo = function(e){ X3DOMObject.displayInfo = function(e){
console.log("displayInfo"); if (Data.markers.length==0){
ui_hideMessage("window-markinfo");
}
//console.log("displayInfo");
var elem = Scene.element; var elem = Scene.element;
...@@ -1048,7 +1071,7 @@ X3DOMObject.displayInfo = function(e){ ...@@ -1048,7 +1071,7 @@ X3DOMObject.displayInfo = function(e){
if (SETTINGS.moreinfo){ if (SETTINGS.moreinfo){
console.log("displayInfo actual displaying"); //console.log("displayInfo actual displaying");
$("#window-info").css({"font-size":"16px"}); $("#window-info").css({"font-size":"16px"});
...@@ -1092,6 +1115,10 @@ X3DOMObject.displayInfo = function(e){ ...@@ -1092,6 +1115,10 @@ X3DOMObject.displayInfo = function(e){
*/ */
X3DOMObject.displayViewInfo = function(e){ X3DOMObject.displayViewInfo = function(e){
if (Data.markers.length==0){
ui_hideMessage("window-markinfo");
}
if (!e.target){ if (!e.target){
e.clientX = $(window).width()/2; e.clientX = $(window).width()/2;
e.clientY = $(window).height()/2; e.clientY = $(window).height()/2;
...@@ -1161,7 +1188,7 @@ X3DOMObject.displayViewInfo = function(e){ ...@@ -1161,7 +1188,7 @@ X3DOMObject.displayViewInfo = function(e){
*/ */
X3DOMObject.displayMarkInfo = function(index){ X3DOMObject.displayMarkInfo = function(index){
console.log("displayMarkInfo"); //console.log("displayMarkInfo");
var hide = false; var hide = false;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<title>Ze Map</title> <title>Ze Map</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<script type='text/javascript' src='js/jquery-3.1.1.js'></script> <script type='text/javascript' src='js/jquery/jquery-3.1.1.js'></script>
<script type='text/javascript' src='js/leaflet/leaflet-src.js'></script> <script type='text/javascript' src='js/leaflet/leaflet-src.js'></script>
<script type='text/javascript' src='js/leaflet/leaflet.camera-view-marker-controls.js'></script> <script type='text/javascript' src='js/leaflet/leaflet.camera-view-marker-controls.js'></script>
<script type='text/javascript' src='js/leaflet/leaflet.camera-view-marker.js'></script> <script type='text/javascript' src='js/leaflet/leaflet.camera-view-marker.js'></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment