Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show other markers on the map in the edit mode #581

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions public/js/module/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ define([
openNewTab: this.openNewTab(),
isPainting: this.isPainting(),
embedded: this.embedded,
editing: this.editing,
year: this.yearLow,
year2: this.yearHigh,
});
Expand Down Expand Up @@ -626,10 +627,22 @@ define([

// Обработчик переключения режима редактирования
editHandler: function (edit) {
this.markerManager.enable();

if (edit) {
this.pointHighlightDestroy().pointEditCreate().markerManager.disable();
const currentPointCid = this.point.cid();
const currentPhoto = this.markerManager.mapObjects.photos[currentPointCid];
// const currentPhotoMarker = currentPhoto?.marker;

this.currentPhotoMarker = currentPhoto.marker;
this.markerManager.layerPhotos.removeLayer(this.currentPhotoMarker);
this.pointHighlightDestroy().pointEditCreate();
} else {
this.pointEditDestroy().pointHighlightCreate().markerManager.enable();
if (this.currentPhotoMarker) {
this.markerManager.layerPhotos.addLayer(this.currentPhotoMarker);
}

this.pointEditDestroy().pointHighlightCreate();
}
},
// Включает режим редактирования
Expand Down
12 changes: 12 additions & 0 deletions public/js/module/map/marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ define([
this.openNewTab = options.openNewTab;
this.embedded = options.embedded;
this.isPainting = options.isPainting;
this.editing = options.editing;
this.year = options.year || undefined;
this.year2 = options.year2 || undefined;

Expand Down Expand Up @@ -963,6 +964,10 @@ define([
* @param {Event} evt
*/
MarkerManager.prototype.clickMarker = function (evt) {
if (this.editing()) {
return;
}

const marker = evt.target;
const object = marker.options.data.obj;
const eventPoint = this.map.mouseEventToContainerPoint(evt.originalEvent);
Expand Down Expand Up @@ -1086,6 +1091,13 @@ define([
}
};
MarkerManager.prototype.popupPhotoOver = function (evt) {
if (this.editing()) {
console.log(this.editing());
return;
}

console.log(this.editing());

const type = evt.target.options.data.type;

window.clearTimeout(this.popupTimeout);
Expand Down
2 changes: 1 addition & 1 deletion public/js/module/photo/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ define(['underscore', 'Utils', 'socket!', 'Params', 'knockout', 'knockout.mappin
this.mapVM.setPoint(this.genMapPoint(), this.isPainting());
},
genMapPoint: function () {
return _.pick(this.p, 'geo', 'year', 'dir', 'title', 'regions');
return _.pick(this.p, 'geo', 'year', 'cid', 'dir', 'title', 'regions');
},
editGeoChange: function (geo) {
if (geo) {
Expand Down
20 changes: 20 additions & 0 deletions public/style/map/map.less
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,26 @@
}

.mapContainer.embedded {
&.editing {
.clusterIcon {
display: none !important;
}

.clusterIconLocal,
.photoIcon {
opacity: 0.4;
cursor: grab;
}

.photoIcon:hover {
width: 8px !important;
height: 8px !important;
margin-left: -4px !important;
margin-top: -4px !important;
.box-shadow(0 0 1px 1px #fff);
}
}

.mapNavigation {
top: -33px;
left: -13px;
Expand Down
2 changes: 1 addition & 1 deletion views/module/map/map.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.mapModuleWrapper(data-bind="with: repository[M!M]")
.mapContainer(data-bind="css: {embedded: embedded}")
.mapContainer(data-bind="css: {embedded: embedded, editing: editing}")
.map

//ko if: embedded
Expand Down