Skip to content

Commit

Permalink
Merge pull request #498 from yileifeng/interactive-map-teleport
Browse files Browse the repository at this point in the history
Add support for teleporting areas of interest content outside RAMP
  • Loading branch information
yileifeng authored Nov 12, 2024
2 parents f08c6dd + bf9202b commit 8ac62f0
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 16 deletions.
13 changes: 10 additions & 3 deletions StoryRampSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,10 @@
"default": false
},
"teleportGrid": {
"type": "boolean",
"description": "Whether or not to teleport grid outside of RAMP instance.",
"default": false
"type": "string",
"description": "Specifies where to teleport grid outside of RAMP instance.",
"default": "",
"enum": ["", "left", "right"]
},
"title": {
"type": "string",
Expand Down Expand Up @@ -272,6 +273,12 @@
"type": "string",
"description": "A title that is displayed centered above this map."
},
"teleportAOI": {
"type": "string",
"description": "Specifies where to teleport areas of interest outside of RAMP instance.",
"default": "",
"enum": ["", "left", "right"]
},
"points": {
"type": "array",
"description": "A list of points of interest.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{
"config": "00000000-0000-0000-0000-000000000000/ramp-config/CommunityDirectory.json",
"type": "map",
"teleportGrid": true,
"teleportGrid": "left",
"scrollguard": true
}
],
Expand All @@ -49,6 +49,7 @@
"type": "interactive-map",
"scrollguard": true,
"title": "Map Title Test",
"teleportAOI": "right",
"points": [
{
"title": "Point of Interest A",
Expand Down
41 changes: 35 additions & 6 deletions src/components/panels/interactive-map.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
<template>
<div ref="el" class="h-full align-middle w-full interactive-container sticky">
<div class="interactive-content z-50">
<div v-for="(point, index) in config.points" :key="`poi-` + index" class="point-of-interest-container">
<PointOfInterestItem :point="point" :index="index" @poi-changed="handlePoint"></PointOfInterestItem>
<div ref="el" class="h-full align-middle w-full">
<!-- if teleporting areas of interest to side of RAMP container -->
<div class="flex teleport-container sm:flex-row flex-col h-full w-full" v-if="config.teleportAOI">
<div class="overflow-x-auto overflow-y-hidden sm:self-start flex-2 sticky z-40">
<div :id="`ramp-map-${slideIdx}`" class="bg-gray-200 rv-map"></div>
</div>
<div class="flex-1">
<div v-for="(point, index) in config.points" :key="`poi-` + index" class="point-of-interest-container">
<PointOfInterestItem
class="point-of-interest"
:point="point"
:index="index"
@poi-changed="handlePoint"
></PointOfInterestItem>
</div>
</div>
</div>

<div class="h-full align-middle w-full interactive-container sticky" v-else>
<div class="interactive-content z-50">
<div v-for="(point, index) in config.points" :key="`poi-` + index" class="point-of-interest-container">
<PointOfInterestItem :point="point" :index="index" @poi-changed="handlePoint"></PointOfInterestItem>
</div>
</div>
<div :id="`ramp-map-${slideIdx}`" class="bg-gray-200 h-story rv-map sticky interactive-content"></div>
</div>
<div :id="`ramp-map-${slideIdx}`" class="bg-gray-200 h-story rv-map sticky interactive-content"></div>
</div>
</template>

Expand Down Expand Up @@ -55,7 +74,9 @@ onMounted(() => {
const init = async () => {
// Find the map component.
mapComponent.value = el.value.children[1];
mapComponent.value = props.config.teleportAOI
? el.value.children[0].children[0].children[0]
: el.value.children[0].children[1];
fetch(props.config.config).then((data) => {
// parse JSON data
Expand Down Expand Up @@ -185,6 +206,14 @@ const handlePoint = (id: string, oid: number, layerIndex?: number) => {
height: calc(100vh - 4rem) !important;
}
}
.teleport-container {
.rv-map {
max-height: 50vh;
}
.point-of-interest {
width: 100%;
}
}
}
:deep(rv-basemap-item .rv-basemap-thumb img) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/story/horizontal-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@click="scrollToChapter('intro')"
v-tippy="{
delay: '200',
placement: 'right',
placement: 'bottom',
content: $t('chapters.return'),
animateFill: true,
animation: 'chapter-menu'
Expand All @@ -25,7 +25,7 @@
target
v-tippy="{
delay: '200',
placement: 'right',
placement: 'bottom',
content: $t('chapters.return'),
animateFill: true,
animation: 'chapter-menu'
Expand All @@ -51,7 +51,7 @@
@click="scrollToChapter(`${slide.index}-${slide.title.toLowerCase().replaceAll(' ', '-')}`)"
v-tippy="{
delay: '200',
placement: 'right',
placement: 'bottom',
content: getTitle(slide),
animateFill: true,
animation: 'chapter-menu'
Expand All @@ -69,7 +69,7 @@
target
v-tippy="{
delay: '200',
placement: 'right',
placement: 'bottom',
content: getTitle(slide),
animateFill: true,
animation: 'chapter-menu'
Expand Down
5 changes: 3 additions & 2 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ export interface MapPanel extends BasePanel {
timeSlider?: TimeSliderConfig;
title: string;
scrollguard: boolean;
teleportGrid?: boolean;
customTemplates: String[];
teleportGrid?: string;
customTemplates: string[];
}

export interface InteractiveMapPanel extends BasePanel {
Expand All @@ -174,6 +174,7 @@ export interface InteractiveMapPanel extends BasePanel {
title: string;
scrollguard: boolean;
points: PointOfInterest[];
teleportAOI?: string;
}

export interface PointOfInterest {
Expand Down

0 comments on commit 8ac62f0

Please sign in to comment.