Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zghywpc-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李苏
zghywpc-vue
Commits
4af55f4d
Commit
4af55f4d
authored
Oct 10, 2024
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
操作模型对象 try 保护
parent
d78fbec1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
55 deletions
+47
-55
index.vue
src/views/yhlywsytst/yhlywsytst/index.vue
+47
-55
No files found.
src/views/yhlywsytst/yhlywsytst/index.vue
View file @
4af55f4d
...
...
@@ -2,7 +2,7 @@
* @Description:
* @Author: lisu lisu@gavelinfo.com
* @LastEditors: lisu lisu@gavelinfo.com
* @LastEditTime: 2024-10-
08 16:51:55
* @LastEditTime: 2024-10-
10 15:08:18
* @FilePath: /zghywpc-vue/src/views/yhlywsytst/yhlywsytst/index.vue
-->
<
template
>
...
...
@@ -1504,63 +1504,55 @@
return
}
let
model
/* 测试判定,实际根据模型实际特征来判定*/
// if (intersects[0].object.name == '') {
// model = intersects[1].object
// } else {
// model = intersects[0].object
// }
let
modelIndex
=
intersects
.
findIndex
(
item
=>
item
.
object
.
name
!==
''
&&
item
.
object
.
visible
==
true
)
if
(
modelIndex
!=-
1
){
rconsole
.
log
(
`当前选中
${
modelIndex
}
`
)
model
=
intersects
[
modelIndex
].
object
}
else
{
console
.
log
(
'本次选中不存在name的节点'
)
}
/* 当模型隐藏 不继续触发*/
if
(
model
.
visible
==
false
)
{
rconsole
.
log
(
'当前对象已屏蔽'
)
return
}
this
.
selectedModel
=
model
// model.visible=false
/* 执行并情况材料队列 */
this
.
reMaterialQue
.
forEach
(
item
=>
{
item
.
revert
()
})
this
.
reMaterialQue
.
splice
(
0
,
this
.
reMaterialQue
.
length
)
/* 添加材质模型队列*/
let
reMaterialQueItem
=
{
model
,
material
:
model
.
material
.
clone
(),
revert
:
function
()
{
this
.
model
.
material
=
this
.
material
}
try
{
let
model
let
modelIndex
=
intersects
.
findIndex
(
item
=>
item
.
object
.
name
!==
''
&&
item
.
object
.
visible
==
true
)
if
(
modelIndex
!=-
1
){
rconsole
.
log
(
`当前选中
${
modelIndex
}
`
)
model
=
intersects
[
modelIndex
].
object
}
else
{
console
.
log
(
'本次选中不存在name的节点'
)
}
/* 当模型隐藏 不继续触发*/
if
(
model
.
visible
==
false
)
{
rconsole
.
log
(
'当前对象已屏蔽'
)
return
}
this
.
selectedModel
=
model
// model.visible=false
/* 执行并情况材料队列 */
this
.
reMaterialQue
.
forEach
(
item
=>
{
item
.
revert
()
})
this
.
reMaterialQue
.
splice
(
0
,
this
.
reMaterialQue
.
length
)
/* 添加材质模型队列*/
let
reMaterialQueItem
=
{
model
,
material
:
model
.
material
.
clone
(),
revert
:
function
()
{
this
.
model
.
material
=
this
.
material
}
}
this
.
reMaterialQue
.
push
(
reMaterialQueItem
)
model
.
material
=
new
THREE
.
MeshPhongMaterial
({
color
:
new
THREE
.
Color
(
'rgba(255, 255, 0, 0.8)'
),
transparent
:
true
,
opacity
:
0.8
,
wireframe
:
false
,
})
}
catch
(
e
){
rconsole
.
log
(
e
)
}
this
.
reMaterialQue
.
push
(
reMaterialQueItem
)
model
.
material
=
new
THREE
.
MeshPhongMaterial
({
color
:
new
THREE
.
Color
(
'rgba(255, 255, 0, 0.8)'
),
transparent
:
true
,
opacity
:
0.8
,
wireframe
:
false
,
})
/* */
// if (this.xzjj) {
// const object = model;
// if (object) {
// this.viewer.cameraControl.fitTo(object);
// }
// }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment