Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
83e615d3
A
AR.js
项目概览
cqiang1993
/
AR.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AR.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83e615d3
编写于
9月 24, 2018
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added credits + removd emitevens option + cameraTransformMatrix
上级
4fb07fa5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
19 deletion
+22
-19
CHANGELOG.md
CHANGELOG.md
+1
-1
aframe/build/aframe-ar.js
aframe/build/aframe-ar.js
+11
-0
aframe/examples/marker-events.html
aframe/examples/marker-events.html
+0
-3
aframe/src/component-anchor.js
aframe/src/component-anchor.js
+10
-15
未找到文件。
CHANGELOG.md
浏览文件 @
83e615d3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
## aframe-ar.js
## aframe-ar.js
-
aframe-ar.js -
`<a-marker>`
elements will emit
`markerFound`
and
`markerLost`
events
, if they have
`emitevents='true'`
set.
-
aframe-ar.js -
`<a-marker>`
elements will emit
`markerFound`
and
`markerLost`
events
- PR #333 thanks @nikolaymihaylov
## Demos
## Demos
...
...
aframe/build/aframe-ar.js
浏览文件 @
83e615d3
...
@@ -8364,10 +8364,21 @@ AFRAME.registerComponent('arjs-anchor', {
...
@@ -8364,10 +8364,21 @@ AFRAME.registerComponent('arjs-anchor', {
// honor visibility
// honor visibility
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
if( _this._arAnchor.parameters.changeMatrixMode === 'modelViewMatrix' ){
if( _this._arAnchor.parameters.changeMatrixMode === 'modelViewMatrix' ){
var wasVisible = _this.el.object3D.visible
_this.el.object3D.visible = this._arAnchor.object3d.visible
_this.el.object3D.visible = this._arAnchor.object3d.visible
}else if( _this._arAnchor.parameters.changeMatrixMode === 'cameraTransformMatrix' ){
}else if( _this._arAnchor.parameters.changeMatrixMode === 'cameraTransformMatrix' ){
var wasVisible = _this.el.sceneEl.object3D.visible
_this.el.sceneEl.object3D.visible = this._arAnchor.object3d.visible
_this.el.sceneEl.object3D.visible = this._arAnchor.object3d.visible
}else console.assert(false)
}else console.assert(false)
// emit markerFound markerLost
if( _this._arAnchor.object3d.visible === true && wasVisible === false ){
_this.el.emit('markerFound')
}else if( _this._arAnchor.object3d.visible === false && wasVisible === true ){
_this.el.emit('markerLost')
}
}
}
})
})
aframe/examples/marker-events.html
浏览文件 @
83e615d3
...
@@ -8,9 +8,6 @@
...
@@ -8,9 +8,6 @@
init
:
function
()
{
init
:
function
()
{
var
marker
=
this
.
el
;
var
marker
=
this
.
el
;
// Make the element emit events when found and when lost.
marker
.
setAttribute
(
'
emitevents
'
,
'
true
'
);
marker
.
addEventListener
(
'
markerFound
'
,
function
()
{
marker
.
addEventListener
(
'
markerFound
'
,
function
()
{
var
markerId
=
marker
.
id
;
var
markerId
=
marker
.
id
;
console
.
log
(
'
markerFound
'
,
markerId
);
console
.
log
(
'
markerFound
'
,
markerId
);
...
...
aframe/src/component-anchor.js
浏览文件 @
83e615d3
...
@@ -34,12 +34,6 @@ AFRAME.registerComponent('arjs-anchor', {
...
@@ -34,12 +34,6 @@ AFRAME.registerComponent('arjs-anchor', {
type
:
'
number
'
,
type
:
'
number
'
,
default
:
0.6
,
default
:
0.6
,
},
},
// Whether to emit events when the element is found or lost.
emitevents
:
{
type
:
'
boolean
'
,
default
:
false
,
}
},
},
init
:
function
()
{
init
:
function
()
{
var
_this
=
this
var
_this
=
this
...
@@ -163,17 +157,19 @@ AFRAME.registerComponent('arjs-anchor', {
...
@@ -163,17 +157,19 @@ AFRAME.registerComponent('arjs-anchor', {
if
(
_this
.
_arAnchor
.
parameters
.
changeMatrixMode
===
'
modelViewMatrix
'
){
if
(
_this
.
_arAnchor
.
parameters
.
changeMatrixMode
===
'
modelViewMatrix
'
){
var
wasVisible
=
_this
.
el
.
object3D
.
visible
var
wasVisible
=
_this
.
el
.
object3D
.
visible
_this
.
el
.
object3D
.
visible
=
this
.
_arAnchor
.
object3d
.
visible
_this
.
el
.
object3D
.
visible
=
this
.
_arAnchor
.
object3d
.
visible
if
(
_this
.
data
.
emitevents
){
if
(
_this
.
el
.
object3D
.
visible
&&
!
wasVisible
){
_this
.
el
.
emit
(
'
markerFound
'
)
}
else
if
(
!
_this
.
el
.
object3D
.
visible
&&
wasVisible
){
_this
.
el
.
emit
(
'
markerLost
'
)
}
}
}
else
if
(
_this
.
_arAnchor
.
parameters
.
changeMatrixMode
===
'
cameraTransformMatrix
'
){
}
else
if
(
_this
.
_arAnchor
.
parameters
.
changeMatrixMode
===
'
cameraTransformMatrix
'
){
var
wasVisible
=
_this
.
el
.
sceneEl
.
object3D
.
visible
_this
.
el
.
sceneEl
.
object3D
.
visible
=
this
.
_arAnchor
.
object3d
.
visible
_this
.
el
.
sceneEl
.
object3D
.
visible
=
this
.
_arAnchor
.
object3d
.
visible
}
else
console
.
assert
(
false
)
}
else
console
.
assert
(
false
)
// emit markerFound markerLost
if
(
_this
.
_arAnchor
.
object3d
.
visible
===
true
&&
wasVisible
===
false
){
_this
.
el
.
emit
(
'
markerFound
'
)
}
else
if
(
_this
.
_arAnchor
.
object3d
.
visible
===
false
&&
wasVisible
===
true
){
_this
.
el
.
emit
(
'
markerLost
'
)
}
}
}
})
})
...
@@ -227,7 +223,6 @@ AFRAME.registerPrimitive('a-marker', AFRAME.utils.extendDeep({}, AFRAME.primitiv
...
@@ -227,7 +223,6 @@ AFRAME.registerPrimitive('a-marker', AFRAME.utils.extendDeep({}, AFRAME.primitiv
'
preset
'
:
'
arjs-anchor.preset
'
,
'
preset
'
:
'
arjs-anchor.preset
'
,
'
minConfidence
'
:
'
arjs-anchor.minConfidence
'
,
'
minConfidence
'
:
'
arjs-anchor.minConfidence
'
,
'
markerhelpers
'
:
'
arjs-anchor.markerhelpers
'
,
'
markerhelpers
'
:
'
arjs-anchor.markerhelpers
'
,
'
emitevents
'
:
'
arjs-anchor.emitevents
'
,
'
hit-testing-renderDebug
'
:
'
arjs-hit-testing.renderDebug
'
,
'
hit-testing-renderDebug
'
:
'
arjs-hit-testing.renderDebug
'
,
'
hit-testing-enabled
'
:
'
arjs-hit-testing.enabled
'
,
'
hit-testing-enabled
'
:
'
arjs-hit-testing.enabled
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录