-
-
-
-
-
+
模型元素
+ style="margin-right: 5px; flex-grow:1" />
-
+
+
+ 刷新
+
+
\ No newline at end of file
+
+
diff --git a/src/editor/widgets/modeltree/ModeltreeViewJs.js b/src/editor/widgets/modeltree/ModeltreeViewJs.js
index 0734559..611941f 100644
--- a/src/editor/widgets/modeltree/ModeltreeViewJs.js
+++ b/src/editor/widgets/modeltree/ModeltreeViewJs.js
@@ -1,35 +1,42 @@
-import { defineComponent } from 'vue'
-import { renderIcon } from '@/utils/webutils.js'
+import { defineComponent, markRaw } from 'vue'
+import YvTable from '@/components/yvTable/YvTable.vue'
import IWidgets from '../IWidgets.js'
-
export default defineComponent({
name: 'ModeltreeView',
+ components: { YvTable },
mixins: [IWidgets],
data() {
+
return {
- searchKeyword: '',
- treedata: data
+ columnSetting: Object.freeze(GRID1_SETTING),
+ grid1Data: [],
+ searchKeyword: ''
}
},
+ mounted() {
+ },
methods: {
- allowDrop(event) {
- return true
- },
- allowDrag(event) {
- return true
- },
- handleDragStart() {
- },
- handleDragEnter() {
- },
- handleDragLeave() {
- },
- handleDragOver() {
+ refreshGrid1() {
+ if (this.viewport?.entityManager) {
+ this.grid1Data = Object.freeze(this.viewport.entityManager.getAllEntityForGrid())
+ } else {
+ this.grid1Data = []
+ }
},
- handleDragEnd() {
+ onGrid1Ready() {
+ this.refreshGrid1()
},
- handleDrop() {
+ grid1RowClick(evt) {
+ console.log(this.$refs.grid1, evt)
+ const { data } = evt
+ if (data?.id) {
+ this.viewport.selectInspect.selectById(data.id)
+ this.viewport.cameraToEntity(data.id)
+
+ } else {
+ system.msg('点位没找到:' + data?.id, 'error')
+ }
}
},
computed: {
@@ -57,60 +64,36 @@ export default defineComponent({
}
})
-const data = [
- {
- label: 'Level one 1',
- children: [
- {
- label: 'Level two 1-1',
- children: [
- {
- label: 'Level three 1-1-1'
- }
- ]
+const GRID1_SETTING = {
+ editable: true,
+ sortable: false,
+ serverSortable: false,
+ rowNumber: false,
+ disableColumnMenu: false,
+ mode: 'edit2',
+ rowHeight: 20,
+ headerHeight: 30,
+ showToolbar: true,
+ disableAppendButton: true,
+ disableDeleteButton: true,
+ // domLayout: 'autoHeight',
+ columns: [
+ { dataIndex: 't', width: 50, header: 't', editable: false, flex: 1 },
+ { dataIndex: 'id', width: 50, header: 'id', editable: false, flex: 1 },
+ {
+ dataIndex: 'pos', width: 50, header: '', editable: false, hidden: true,
+ valueGetter(evt) {
+ const item = evt.data
+ return _.get(item, 'tf[0][0]') + ',' + _.get(item, 'tf[0][1]') + ',' + _.get(item, 'tf[0][2]')
}
- ]
- },
- {
- label: 'Level one 2',
- children: [
- {
- label: 'Level two 2-1',
- children: [
- {
- label: 'Level three 2-1-1'
- }
- ]
- },
- {
- label: 'Level two 2-2',
- children: [
- {
- label: 'Level three 2-2-1'
- }
- ]
- }
- ]
- },
- {
- label: 'Level one 3',
- children: [
- {
- label: 'Level two 3-1',
- children: [
- {
- label: 'Level three 3-1-1'
- }
- ]
- },
- {
- label: 'Level two 3-2',
- children: [
- {
- label: 'Level three 3-2-1'
- }
- ]
+ },
+ {
+ dataIndex: 'size', width: 50, header: '', editable: false, hidden: true,
+ valueGetter(evt) {
+ const item = evt.data
+ return _.get(item, 'tf[2][0]') + ',' + _.get(item, 'tf[2][1]') + ',' + _.get(item, 'tf[2][2]')
}
- ]
- }
-]
\ No newline at end of file
+ }
+ ]
+}
+
diff --git a/src/modules/gstore/GstoreRenderer.ts b/src/modules/gstore/GstoreRenderer.ts
index fe907a6..c147caf 100644
--- a/src/modules/gstore/GstoreRenderer.ts
+++ b/src/modules/gstore/GstoreRenderer.ts
@@ -5,7 +5,6 @@ import { type Object3DLike } from '@/types/ModelTypes.ts'
import InstancePointManager from '@/core/manager/InstancePointManager.ts'
import LineSegmentManager from '@/core/manager/LineSegmentManager.ts'
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial'
-import { itemToOBB } from '@/core/manager/ItemFindManager.ts'
import { getOBBox } from '@/core/ModelUtils.ts'
/**
diff --git a/src/types/Types.d.ts b/src/types/Types.d.ts
index 7b91269..4eb456d 100644
--- a/src/types/Types.d.ts
+++ b/src/types/Types.d.ts
@@ -63,3 +63,11 @@ interface CatalogGroup {
* 世界模型目录数据
*/
type Catalog = CatalogGroup[];
+
+interface IControls {
+ init(viewport: any): void
+
+ dispose(): void
+
+ animate?: () => void;
+}
diff --git a/src/utils/webutils.ts b/src/utils/webutils.ts
index e0a9124..e970d64 100644
--- a/src/utils/webutils.ts
+++ b/src/utils/webutils.ts
@@ -234,3 +234,70 @@ export function renderIcon(icon: string, props = {}): any {
}
return () => h(ElIcon, props, { default: () => h(component) })
}
+
+
+/**
+ * 运行事件
+ * @param scope vcxt.scope
+ * @param vjson VJSON,是指能包含 listeners 属性的对象
+ * @param eventName 事件名
+ * @param args 事件参数
+ */
+export function runEvent(scope, vjson, eventName, ...args) {
+ if (!vjson.listeners) {
+ return
+ }
+ if (typeof vjson.listeners[eventName] === 'string') {
+ let funcBody = vjson.listeners[eventName]
+ const me = scope
+ const methodVarName = []
+
+ // // 吧 args 参数添加进去
+ _.forEach(args, (v, k) => {
+ methodVarName.push('arg' + k)
+ })
+
+ // 花括号定义模式
+ if (_.startsWith(funcBody, '{')) {
+ if (_.endsWith(funcBody, '}')) {
+ // 剔除花括号
+ const methodName = funcBody.substring(1, funcBody.length - 1)
+
+ // 检查有没有其他符号
+ if (methodName.includes('+') || methodName.includes('-') || methodName.includes('(') ||
+ methodName.includes(')') || methodName.includes('*') || methodName.includes('/') ||
+ methodName.includes('{') || methodName.includes('}') || methodName.includes(' ')) {
+ console.error('错误表达式:' + funcBody)
+ return
+ }
+ // funcBody = "return this." + funcBody + "(arguments);"
+ try {
+ return me[methodName].call(me, ...args)
+ } catch (e) {
+ console.error(`页面方法(methodName=${methodName})运行错误`, '页面对象', me, '页面方法对象', me[methodName], '错误', e)
+ system.showErrorDialog('方法运行错误' + e)
+ return
+ }
+
+ } else {
+ console.error('错误表达式:' + funcBody)
+ return
+ }
+ }
+
+ const func = Function(...methodVarName, funcBody)
+ try {
+ return func.bind(scope)(...args)
+ } catch (e) {
+ console.error('runEventError', e)
+ //@ts-ignore
+ system.showErrorDialog(e.toString())
+ return
+ }
+ }
+ if (typeof vjson.listeners[eventName] === 'function') {
+ //@ts-ignore
+ return vjson.listeners[eventName].call(scope, this, ...args)?.catch?.(() => {
+ })
+ }
+}