Skip to content

Commit 00ae444

Browse files
author
webbery
committed
🚧切换内容视图同步更新属性面板;修复路由存在的问题
1 parent c0d2d01 commit 00ae444

10 files changed

Lines changed: 37 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
#### 主模块
55
- 插件化内容视图
6-
-
76
#### 扩展模块
87
- 优化原视图界面显示
8+
- 使用[Google model view](https://modelviewer.dev)构建3D模型展示插件,支持glb,gltf格式
99

1010
#### 通讯模块
1111
- 当前资源库信息同步功能

src/civet.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ declare module 'civet' {
201201
* @param listener a listener is defined for reading html file and it's content should be return
202202
*/
203203
onViewInitialize(listener: () => string): void;
204+
onNextResourceDisplay(): void;
205+
onPrevResourceDisplay(): void;
204206
}
205207

206208
export namespace window {

src/renderer/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default {
9999
if (resourceInfo !== null) {
100100
resourceInfo['id'] = resourceID
101101
console.info('onResourceShow:', resourceInfo)
102-
this.$router.push({name: 'view-resource', params: resourceInfo, query: {name: resourceInfo.filename, cmd: 'display'}})
102+
this.$router.push({name: 'view-resource', params: resourceInfo, query: {name: resourceInfo.filename || resourceInfo.name, cmd: 'display'}})
103103
}
104104
},
105105
onClassOpen(classpath) {

src/renderer/components/HeaderBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default {
149149
// },
150150
onUpdateHeadNav(query) {
151151
this.viewDesc = query.name
152-
console.info(query.cmd)
152+
console.info('onUpdateHeadNav', query.cmd)
153153
switch (query.cmd) {
154154
case 'display-tag':
155155
case 'display-all':

src/renderer/components/ImageOperator.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818
},
1919
methods: {
2020
onUpdateDisplayName(name) {
21+
console.info('display resource name:', name)
2122
this.filename = name
2223
}
2324
}
@@ -26,6 +27,7 @@ export default {
2627

2728
<style scoped>
2829
div{
29-
align-content: center;
30+
display: flex;
31+
justify-content: center;
3032
}
3133
</style>

src/renderer/components/Panel/ContentPanel.vue

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,24 @@ export default {
5050
if (this.resource.type) {
5151
this.$ipcRenderer.on(IPCRendererResponse.ON_EXTENSION_CONTENT_UPDATE, this.onContentViewUpdate)
5252
this.$ipcRenderer.send(IPCNormalMessage.RETRIEVE_CONTENT_VIEW, this.resource.type)
53-
bus.emit(bus.EVENT_UPDATE_NAV_DESCRIBTION, {name: '图片显示', cmd: 'display'})
54-
// for (let idx = 0; idx < this.candidates.length; ++idx) {
55-
// if (this.candidates[idx].id === this.image.id) {
56-
// this.index = idx
57-
// this.$nextTick(() => {
58-
// bus.emit(bus.EVENT_DISPLAY_FILE_NAME, this.candidates[idx].filename)
59-
// })
60-
// break
61-
// }
62-
// }
53+
bus.emit(bus.EVENT_UPDATE_NAV_DESCRIBTION, {name: '资源', cmd: 'display'})
54+
for (let idx = 0; idx < this.candidates.length; ++idx) {
55+
if (this.candidates[idx].id === this.resource.id) {
56+
this.index = idx
57+
break
58+
}
59+
}
6360
} else {
6461
// unkonw file type
6562
}
63+
this.$nextTick(() => {
64+
bus.emit(bus.EVENT_DISPLAY_FILE_NAME, this.resource.filename || this.resource.name)
65+
})
66+
},
67+
watch: {
68+
$route: function(to, from) {
69+
console.info('content panel, to: ', to, 'from:', from.path)
70+
}
6671
},
6772
async updated() {
6873
if (this.isUpdated) return
@@ -76,19 +81,22 @@ export default {
7681
return
7782
}
7883
const path = require('path')
79-
events.emit('ContentView:' + contentView, 'load', path.normalize(this.resource._path))
84+
events.emit('ContentView:' + contentView, 'load', path.normalize(this.candidates[this.index].path))
8085
this.isUpdated = true
8186
},
8287
methods: {
8388
onClickNext() {
84-
console.info('next image')
89+
console.info('next image', this.index)
8590
if (this.index > this.candidates.length) {
8691
this.index = this.candidates.length
8792
return
8893
}
8994
this.index += 1
9095
bus.emit(bus.EVENT_DISPLAY_FILE_NAME, this.candidates[this.index].filename)
91-
bus.emit(bus.EVENT_SELECT_IMAGE, this.candidates[this.index].id)
96+
const id = this.candidates[this.index].id
97+
this.$ipcRenderer.send(IPCNormalMessage.GET_SELECT_CONTENT_ITEM_INFO, {id: [id]})
98+
const type = this.candidates[this.index].type
99+
this.$ipcRenderer.send(IPCNormalMessage.RETRIEVE_CONTENT_VIEW, type)
92100
},
93101
onClickPrev() {
94102
console.info('prev image')
@@ -98,7 +106,10 @@ export default {
98106
}
99107
this.index -= 1
100108
bus.emit(bus.EVENT_DISPLAY_FILE_NAME, this.candidates[this.index].filename)
101-
bus.emit(bus.EVENT_SELECT_IMAGE, this.candidates[this.index].id)
109+
const id = this.candidates[this.index].id
110+
this.$ipcRenderer.send(IPCNormalMessage.GET_SELECT_CONTENT_ITEM_INFO, {id: [id]})
111+
const type = this.candidates[this.index].type
112+
this.$ipcRenderer.send(IPCNormalMessage.RETRIEVE_CONTENT_VIEW, type)
102113
},
103114
onContentViewUpdate(session, value) {
104115
console.debug('onContentViewUpdate:', value)

src/renderer/components/Panel/PropertyPanel.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export default {
9898
candidateClasses: state => state.Cache.classesName
9999
}),
100100
mounted() {
101-
// bus.on(bus.EVENT_SELECT_IMAGE, this.displayProperty)
102101
this.event = this.$events.get('PropertyView')
103102
this.event.on('click', this.cleanProperty, this)
104103
this.$ipcRenderer.on('Property', this.onViewUpdate)

src/renderer/components/Panel/WebPanel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default {
4646
updateCurrentViewName(config.defaultView)
4747
// this.$ipcRenderer.send(IPCNormalMessage.REQUEST_UPDATE_RESOURCES)
4848
this.$ipcRenderer.send(IPCNormalMessage.RETRIEVE_OVERVIEW, config.defaultView)
49+
bus.emit(bus.EVENT_UPDATE_NAV_DESCRIBTION, {name: '全部', cmd: 'display-all'})
4950
},
5051
watch: {
5152
$route: function(to, from) {

src/renderer/components/utils/Bus.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export default {
1212
},
1313
EVENT_UPDATE_IMAGE_IMPORT_DIRECTORY: 'updateImportDirectory',
1414
EVENT_UPDATE_DISPLAY_IMAGE: 'updateDisplayImage',
15-
EVENT_SELECT_IMAGE: 'selectImage',
1615
EVENT_DISPLAY_FILE_NAME: 'displayFileName',
1716
EVENT_REMOVE_FILES: 'removeFiles',
1817
EVENT_REMOVE_ITEM: 'removeTreeItem',

src/worker/view/extHostContentView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class ExtContentView extends ExtHostWebView {
5555
this.html = html
5656
return this.getHtml()
5757
}
58+
59+
onNextResourceDisplay(): void {}
60+
onPrevResourceDisplay(): void {}
5861
}
5962

6063
@injectable

0 commit comments

Comments
 (0)