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

Add a new annotation tab for displaying annotation tool #91

Merged
merged 9 commits into from
Nov 14, 2024
Merged
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
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ VITE_APP_PENNSIEVE_API_LOCATION=https://api.pennsieve.io
VITE_APP_ALGOLIA_INDEX=k-core_dev_published_time_desc
VITE_APP_BL_SERVER_URL=
VITE_APP_NL_LINK_PREFIX=
VITE_APP_ROOT_URL=
VITE_APP_ROOT_URL=
VITE_FLATMAPAPI_LOCATION=https://mapcore-demo.org/curation/flatmap/
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [v2.4.2](https://github.com/alan-wu/map-sidebar/compare/v2.4.1...v2.4.2)
## [v2.5.0-beta.3](https://github.com/alan-wu/map-sidebar/compare/v2.5.0-beta.2...v2.5.0-beta.3)

### Commits

- Update map utilities. [`f3ec595`](https://github.com/alan-wu/map-sidebar/commit/f3ec595a7ce6923e2de0bdac98a63a34126b48fe)

## [v2.5.0-beta.2](https://github.com/alan-wu/map-sidebar/compare/v2.5.0-beta.1...v2.5.0-beta.2) - 2024-10-30

### Commits

- Increment utilities. [`cc4d81a`](https://github.com/alan-wu/map-sidebar/commit/cc4d81ad21c523ee77756be68e2a87c150b788ba)

## [v2.5.0-beta.1](https://github.com/alan-wu/map-sidebar/compare/v2.4.2...v2.5.0-beta.1) - 2024-10-30

### Commits

- Improve annotation tool on sidebar. [`cf78a55`](https://github.com/alan-wu/map-sidebar/commit/cf78a5592d61698733101679faf01fba2bdd1473)
- Add annotation tool to the sidebar. [`3272595`](https://github.com/alan-wu/map-sidebar/commit/3272595b5f1a47b01f14645a6a32ecd217ddd26f)

## [v2.4.2](https://github.com/alan-wu/map-sidebar/compare/v2.4.1...v2.4.2) - 2024-10-09

### Merged

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abi-software/map-side-bar",
"version": "2.4.2",
"version": "2.5.0-beta.3",
"files": [
"dist/*",
"src/*",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@abi-software/gallery": "^1.1.2",
"@abi-software/map-utilities": "^1.1.3-beta.11",
"@abi-software/map-utilities": "^1.2.0",
"@abi-software/svg-sprite": "^1.0.1",
"@element-plus/icons-vue": "^2.3.1",
"algoliasearch": "^4.10.5",
Expand Down
31 changes: 30 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<el-button @click="neuronSearch">open neuron search</el-button>
<el-button @click="keywordSearch">keyword search</el-button>
<el-button @click="getFacets">Get facets</el-button>
<el-button @click="toggleCreateData">Create Data/Annotation</el-button>
</div>
<SideBar
:envVars="envVars"
Expand All @@ -22,6 +23,8 @@
:visible="sideBarVisibility"
:tabs="tabs"
:activeTabId="activeId"
:annotationEntry="annotationEntry"
:createData="createData"
:connectivityInfo="connectivityInput"
@tabClicked="tabClicked"
@search-changed="searchChanged($event)"
Expand Down Expand Up @@ -101,8 +104,16 @@ export default {
},
data: function () {
return {
annotationEntry: {
featureId :"epicardium",
resourceId: "https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json","resource":"https://mapcore-bucket1.s3-us-west-2.amazonaws.com/others/29_Jan_2020/heartICN_metadata.json"
},
contextArray: [null, null],
tabArray: [{ title: 'Flatmap', id: 1, type: 'search'}, { title: 'Connectivity', id: 2, type: 'connectivity' }],
tabArray: [
{ title: 'Flatmap', id: 1, type: 'search'},
{ title: 'Connectivity', id: 2, type: 'connectivity' },
{ title: 'Annotation', id: 3, type: 'annotation' },
],
sideBarVisibility: true,
envVars: {
API_LOCATION: import.meta.env.VITE_APP_API_LOCATION,
Expand All @@ -117,6 +128,7 @@ export default {
},
connectivityInput: exampleConnectivityInput,
activeId: 1,
createData: null,
}
},
methods: {
Expand Down Expand Up @@ -226,6 +238,23 @@ export default {
let facets = await this.$refs.sideBar.getAlgoliaFacets()
console.log('Algolia facets:', facets)
},
toggleCreateData : function() {
if (!this.createData) {
this.createData = {
drawingBox: false,
toBeConfirmed: true,
points: [[1.0, 1.0, 1.0]],
shape: "Lines",
x: 0,
y: 0,
editingIndex: -1,
faceIndex: -1,
toBeDeleted: false,
}
} else {
this.createData = null
}
},
onConnectivityComponentClick: function(data) {
console.log("onConnectivityComponentClick" , data)
}
Expand Down
3 changes: 3 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ export {}

declare module 'vue' {
export interface GlobalComponents {
AnnotationTool: typeof import('./components/AnnotationTool.vue')['default']
BadgesGroup: typeof import('./components/BadgesGroup.vue')['default']
ConnectivityInfo: typeof import('./components/ConnectivityInfo.vue')['default']
DatasetCard: typeof import('./components/DatasetCard.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCascader: typeof import('element-plus/es')['ElCascader']
ElCol: typeof import('element-plus/es')['ElCol']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElIconArrowLeft: typeof import('@element-plus/icons-vue')['ArrowLeft']
Expand All @@ -24,6 +26,7 @@ declare module 'vue' {
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTag: typeof import('element-plus/es')['ElTag']
ExternalResourceCard: typeof import('./components/ExternalResourceCard.vue')['default']
Expand Down
145 changes: 145 additions & 0 deletions src/components/AnnotationTool.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<template>
<div class="annotation-tool scrollbar">
<CreateTooltipContent
v-show="createData && createData.toBeConfirmed"
:createData="createData"
@confirm-create="$emit('confirm-create', $event)"
@cancel-create="$emit('cancel-create')"
class="create-tooltip-content"
/>
<annotation-popup
v-if="annotationEntry && (!createData || !createData.toBeConfirmed)"
class="annotation-popup"
:annotationEntry="annotationEntry"
@annotation="$emit('annotation', $event)"
/>
<div v-if="createData && createData.toBeDeleted" class="delete-container">
<el-row>
<el-col :offset="1" :span="6">Delete this feature?</el-col>
<el-col :offset="1" :span="3">
<el-button
class="delete-button"
:icon="ElIconDelete"
@click="$emit('confirm-delete')"
>
Delete
</el-button>
</el-col>
<el-col :offset="1" :span="2">
<el-button
class="delete-button"
@click="$emit('cancel-create')"
>
Dismiss
</el-button>
</el-col>
</el-row>
</div>
</div>
</template>

<script>
import { shallowRef } from 'vue';
import { AnnotationPopup, CreateTooltipContent } from '@abi-software/map-utilities';
import '@abi-software/map-utilities/dist/style.css';
import {
ElButton as Button,
ElCol as Col,
ElRow as Row,
ElIcon as Icon,
} from 'element-plus'
import {
Delete as ElIconDelete,
} from '@element-plus/icons-vue'

export default {
name: 'AnnotationTool',
components: {
AnnotationPopup,
Button,
CreateTooltipContent,
Col,
ElIconDelete,
Icon,
Row,
},
props: {
annotationEntry: {
type: Object,
},
createData: {
type: Object,
default: {},
}
},
data: function () {
return {
ElIconDelete: shallowRef(ElIconDelete),
};
},
}
</script>

<style scoped lang="scss">
.annotation-tool {
background-color: #f7faff;
height: 100%;
overflow-y: auto;
}

.scrollbar::-webkit-scrollbar-track {
border-radius: 10px;
background-color: #f5f5f5;
}

.scrollbar::-webkit-scrollbar {
width: 12px;
right: -12px;
background-color: #f5f5f5;
}

.scrollbar::-webkit-scrollbar-thumb {
border-radius: 4px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
background-color: #979797;
}

.annotation-popup.main {
font-size: 14px;
text-align: left;
line-height: 1.5em;
font-family: Asap, sans-serif, Helvetica;
font-weight: 400;
/* outline: thin red solid; */
overflow-y: auto;
scrollbar-width: thin;
min-width: 16rem;
max-height: unset;
background-color: #f7faff;
border-left: 1px solid var(--el-border-color);
border-top: 1px solid var(--el-border-color);
}

.delete-container {
margin-top: 12px;
margin-bottom: 12px;
font-size: 14px;
.delete-button {
pointer-events: auto;
cursor: pointer;
margin-left:8px;
padding-left: 8px;
padding-right: 8px;
height: 24px !important;
color: $app-primary-color;
&:hover {
background-color: var(--el-color-primary-light-9);
}
}
}

.create-container.create-tooltip-content {
background-color: #f7faff;
}

</style>
Loading