2020-07-22 15:00:22 +00:00
|
|
|
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
import {V8CustomElement, defineCustomElement} from '../helper.mjs';
|
2020-08-06 14:41:38 +00:00
|
|
|
import {SelectEvent} from '../events.mjs';
|
2020-07-22 15:00:22 +00:00
|
|
|
|
|
|
|
defineCustomElement('./map-panel/map-details', (templateText) =>
|
|
|
|
class MapDetails extends V8CustomElement {
|
|
|
|
constructor() {
|
|
|
|
super(templateText);
|
|
|
|
this.mapDetails.addEventListener('click', () => this.handleClickSourcePositions());
|
|
|
|
this.selectedMap = undefined;
|
|
|
|
}
|
|
|
|
get mapDetails() {
|
|
|
|
return this.$('#mapDetails');
|
|
|
|
}
|
|
|
|
|
|
|
|
setSelectedMap(value) {
|
|
|
|
this.selectedMap = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
set mapDetails(map){
|
|
|
|
let details = '';
|
|
|
|
if (map) {
|
|
|
|
details += 'ID: ' + map.id;
|
|
|
|
details += '\nSource location: ' + map.filePosition;
|
|
|
|
details += '\n' + map.description;
|
|
|
|
this.setSelectedMap(map);
|
|
|
|
}
|
|
|
|
this.mapDetails.innerText = details;
|
|
|
|
}
|
|
|
|
|
|
|
|
handleClickSourcePositions(){
|
2020-08-06 14:41:38 +00:00
|
|
|
this.dispatchEvent(new SelectEvent(this.selectedMap.filePosition));
|
2020-07-22 15:00:22 +00:00
|
|
|
}
|
|
|
|
});
|