-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add Korok Type List in Filter Pane #71
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import * as MapIcons from '@/MapIcon'; | |
import * as MapMarkers from '@/MapMarker'; | ||
import { MapMarker, SearchResultUpdateMode } from '@/MapMarker'; | ||
import { MapMarkerGroup } from '@/MapMarkerGroup'; | ||
import { SearchResultGroup, SearchExcludeSet, SEARCH_PRESETS } from '@/MapSearch'; | ||
import { SearchResultGroup, SearchExcludeSet, SEARCH_PRESETS, KOROK_TYPES } from '@/MapSearch'; | ||
import * as save from '@/save'; | ||
|
||
import MixinUtil from '@/components/MixinUtil'; | ||
|
@@ -240,6 +240,9 @@ export default class AppMap extends mixins(MixinUtil) { | |
private searchResultMarkers: ui.Unobservable<MapMarkers.MapMarkerSearchResult>[] = []; | ||
private searchGroups: SearchResultGroup[] = []; | ||
private searchPresets = SEARCH_PRESETS; | ||
private korokTypes = KOROK_TYPES; | ||
private korokTypeOn = KOROK_TYPES.map(t => false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. enabledKorokTypes? |
||
private korokTypeOpen: boolean = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "filterOnKorokTypes" -- this name isn't super clear atm |
||
private searchExcludedSets: SearchExcludeSet[] = []; | ||
private readonly MAX_SEARCH_RESULT_COUNT = 2000; | ||
|
||
|
@@ -804,6 +807,42 @@ export default class AppMap extends mixins(MixinUtil) { | |
this.search(); | ||
} | ||
|
||
async addKorokType(name: string, query: string) { | ||
let objs = await MapMgr.getInstance().getObjs(this.settings!.mapType, | ||
this.settings!.mapName, query); | ||
objs.forEach((obj: any) => { | ||
obj.Translate = { X: obj.pos[0], Y: obj.pos[1], Z: obj.pos[2] }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this necessary? |
||
obj.id = obj.korok_type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? Is there no other way of doing this? Not a big fan of overwriting a property with completely unrelated data... |
||
}); | ||
let group = new MapMarkerGroup( | ||
objs.map((m: any) => | ||
new MapMarkers.MapMarkerKorok(this.map, m, { | ||
showLabel: this.showKorokIDs, | ||
styleLabel: false | ||
})), | ||
1.0, false); | ||
this.markerGroups.set(name, group); | ||
group.addToMap(this.map.m); | ||
|
||
for (const group of this.markerGroups.values()) | ||
group.update(); | ||
|
||
} | ||
|
||
searchToggleGroup(name: string) { | ||
const ROCK_LIFT_QUERY = 'korok_type: "Rock Lift" NOT Leaves NOT Pile NOT Slab NOT Door NOT Boulder'; | ||
let query = `korok_type: "${name}"`; | ||
if (name == "Rock Lift") { | ||
query = ROCK_LIFT_QUERY; | ||
} | ||
if (this.markerGroups.has(name)) { | ||
this.markerGroups.get(name)!.destroy(); | ||
this.markerGroups.delete(name); | ||
} else { | ||
this.addKorokType(name, query); | ||
} | ||
} | ||
|
||
searchRemoveGroup(idx: number) { | ||
const group = this.searchGroups[idx]; | ||
group.remove(); | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -139,6 +139,14 @@ | |||||
<AppMapFilterMainButton v-for="(v, type) in markerComponents" :key="type" :type="type" :label="v.filterLabel" :icon="v.filterIcon" @toggle="updateMarkers" /> | ||||||
</div> | ||||||
<b-checkbox switch v-model="showKorokIDs" @change="updateKorokIDs">Show Korok IDs</b-checkbox> | ||||||
<b-checkbox v-model="korokTypeOpen" switch >Korok Types</b-checkbox> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the UX is somewhat confusing. It's in the filter pane so I would have expected this feature to filter visible Korok markers, not add/remove extra search groups. |
||||||
|
||||||
<b-collapse id="korokTypesList" class="mt-2" v-model="korokTypeOpen"> | ||||||
<b-card style="background: rgba(0,0,0,0); overflow-y: scroll; max-height: 300px; border:1px solid #333;"> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move the styles into CSS. |
||||||
<b-checkbox v-for="(ktype, index) in korokTypes" :key="ktype" ref="koroks" v-model="korokTypeOn[index]" :checked=false switch @input='searchToggleGroup(ktype)'>{{ktype}}</b-checkbox> | ||||||
</b-card> | ||||||
</b-collapse> | ||||||
|
||||||
<hr> | ||||||
<h4 class="subsection-heading">Visible map areas</h4> | ||||||
<b-radio-group stacked class="mb-4" v-model="shownAreaMap" @change="onShownAreaMapChanged"> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.