mirror of
https://github.com/ccmdi/obsidian-map-plus.git
synced 2026-07-22 06:43:14 +00:00
Merge pull request #2 from ccmdi/fix/release
Bugfix and transition setting
This commit is contained in:
commit
c7f6b4e48b
6 changed files with 39 additions and 31 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "mapplus",
|
||||
"name": "Map+",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"minAppVersion": "1.10.0",
|
||||
"description": "A performant and customizable map inside Bases",
|
||||
"author": "ccmdi",
|
||||
|
|
|
|||
20
src/main.ts
20
src/main.ts
|
|
@ -1,25 +1,7 @@
|
|||
import { Plugin } from 'obsidian';
|
||||
import { MapBasesView } from './views/map-bases-view';
|
||||
import { MapTagSettings, DEFAULT_MAP_TAG_SETTINGS } from './settings/map-tag-settings';
|
||||
import { MapSettingTab } from './settings/map-settings';
|
||||
|
||||
interface MapPluginSettings {
|
||||
latKey: string;
|
||||
lngKey: string;
|
||||
strokeWidth: number;
|
||||
iconFill: boolean;
|
||||
autoCenter: boolean;
|
||||
tagSettings: MapTagSettings;
|
||||
}
|
||||
|
||||
const DEFAULT_SETTINGS: MapPluginSettings = {
|
||||
latKey: '',
|
||||
lngKey: '',
|
||||
strokeWidth: 2.5,
|
||||
iconFill: false,
|
||||
autoCenter: true,
|
||||
tagSettings: DEFAULT_MAP_TAG_SETTINGS
|
||||
};
|
||||
import { MapSettingTab, MapPluginSettings, DEFAULT_SETTINGS } from './settings/map-settings';
|
||||
|
||||
export default class MapPlugin extends Plugin {
|
||||
settings: MapPluginSettings;
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ export function updateMapPoints(deck: Deck<MapViewType[]>, points: MapPoint[], c
|
|||
initialViewState: {
|
||||
MapView: {
|
||||
...targetViewState,
|
||||
transitionDuration: 800,
|
||||
transitionDuration: settings.transitionDuration,
|
||||
transitionInterpolator: new FlyToInterpolator(),
|
||||
transitionEasing: easeCubic,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
import { PluginSettingTab, App, Setting } from "obsidian";
|
||||
import MapPlugin from "../main";
|
||||
import { renderTagCustomizations } from "./map-tag-settings";
|
||||
import { DEFAULT_MAP_TAG_SETTINGS, MapTagSettings, renderTagCustomizations } from "./map-tag-settings";
|
||||
|
||||
export interface MapPluginSettings {
|
||||
latKey: string;
|
||||
lngKey: string;
|
||||
strokeWidth: number;
|
||||
iconFill: boolean;
|
||||
autoCenter: boolean;
|
||||
transitionDuration: number;
|
||||
tagSettings: MapTagSettings;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: MapPluginSettings = {
|
||||
latKey: '',
|
||||
lngKey: '',
|
||||
strokeWidth: 2.5,
|
||||
iconFill: false,
|
||||
autoCenter: true,
|
||||
transitionDuration: 1000,
|
||||
tagSettings: DEFAULT_MAP_TAG_SETTINGS
|
||||
};
|
||||
|
||||
export class MapSettingTab extends PluginSettingTab {
|
||||
plugin: MapPlugin;
|
||||
|
|
@ -70,6 +90,18 @@ export class MapSettingTab extends PluginSettingTab {
|
|||
this.plugin.settings.autoCenter = value;
|
||||
await this.plugin.saveSettings();
|
||||
}));
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Transition duration')
|
||||
.setDesc('Duration of the transition when changing view state')
|
||||
.addSlider(slider => slider
|
||||
.setLimits(0, 2000, 100)
|
||||
.setValue(this.plugin.settings.transitionDuration)
|
||||
.setDynamicTooltip()
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.transitionDuration = value;
|
||||
await this.plugin.saveSettings();
|
||||
}));
|
||||
|
||||
renderTagCustomizations(containerEl, this.app, this.plugin);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ export class MapBasesView extends BasesView {
|
|||
this.containerEl.removeClass('is-loading');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const loadingOverlay = this.containerEl.createDiv({ cls: 'map-loading-overlay' });
|
||||
const spinner = loadingOverlay.createDiv();
|
||||
|
||||
|
|
@ -186,13 +186,6 @@ export class MapBasesView extends BasesView {
|
|||
|
||||
const points = this.extractPointsFromData();
|
||||
|
||||
if (points.length === 0) {
|
||||
this.mapEl.empty();
|
||||
const emptyState = this.mapEl.createDiv({ cls: 'map-empty-state' });
|
||||
emptyState.textContent = 'No entries with valid coordinates found';
|
||||
return;
|
||||
}
|
||||
|
||||
const isEmbedded = this.isEmbedded();
|
||||
const height = isEmbedded ? `${this.mapHeight}px` : '100%';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"1.0.0": "1.10.0",
|
||||
"1.0.1": "1.10.0"
|
||||
"1.0.1": "1.10.0",
|
||||
"1.0.2": "1.10.0"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue