|
542 | 542 | case 'setAttributes': { |
543 | 543 | for (let i = 0; i < values.length; i++) { |
544 | 544 | const {key, value} = values[i]; |
545 | | - el.setAttribute(key, value); |
| 545 | + (el.setAttributeRaw || el.setAttribute).call(el, key, value); |
546 | 546 | } |
547 | 547 | break; |
548 | 548 | } |
549 | 549 | case 'setAttribute': { |
550 | | - el.setAttribute(key, value); |
| 550 | + (el.setAttributeRaw || el.setAttribute).call(el, key, value); |
551 | 551 | break; |
552 | 552 | } |
553 | 553 | case 'removeAttribute': { |
|
3874 | 3874 | attributeFilter: ['position', 'orientation', 'scale', 'data'], |
3875 | 3875 | attributes: true, |
3876 | 3876 | }); |
| 3877 | + |
| 3878 | + assetXrIframe.setAttributeRaw = assetXrIframe.setAttribute; |
| 3879 | + assetXrIframe.setAttribute = (name, value) => { |
| 3880 | + assetXrIframe.setAttributeRaw(name, value); |
| 3881 | + |
| 3882 | + if (rtcWs) { |
| 3883 | + rtcWs.send(JSON.stringify({ |
| 3884 | + method: 'editState', |
| 3885 | + spec: { |
| 3886 | + keyPath: [0, '#' + assetXrIframe.id], |
| 3887 | + method: 'setAttributes', |
| 3888 | + values: [ |
| 3889 | + { |
| 3890 | + key: 'position', |
| 3891 | + value: assetXrIframe.getAttribute('position'), |
| 3892 | + }, |
| 3893 | + { |
| 3894 | + key: 'orientation', |
| 3895 | + value: assetXrIframe.getAttribute('orientation'), |
| 3896 | + }, |
| 3897 | + { |
| 3898 | + key: 'data', |
| 3899 | + value: assetXrIframe.getAttribute('data'), |
| 3900 | + }, |
| 3901 | + ], |
| 3902 | + }, |
| 3903 | + })); |
| 3904 | + } |
| 3905 | + }; |
3877 | 3906 | } |
3878 | 3907 | })).then(() => {}); |
3879 | 3908 | await _loadAssetMoveMeshes(); |
|
4370 | 4399 | const idAttr = stateXrIframe.attrs.find(attr => attr.name === 'id'); |
4371 | 4400 | if (idAttr) { |
4372 | 4401 | const id = idAttr.value; |
4373 | | - const xrIframe = assetXrIframes.find(xrIframe => xrIframe.id === id); |
4374 | | - if (xrIframe) { |
| 4402 | + const assetXrIframe = assetXrIframes.find(xrIframe => xrIframe.id === id); |
| 4403 | + if (assetXrIframe) { |
4375 | 4404 | for (let j = 0; j < stateXrIframe.attrs.length; j++) { |
4376 | 4405 | const attr = stateXrIframe.attrs[j]; |
4377 | 4406 | const {name, value} = attr; |
4378 | | - xrIframe.setAttribute(name, value); |
| 4407 | + assetXrIframe.setAttributeRaw(name, value); |
4379 | 4408 | } |
4380 | 4409 | } |
4381 | 4410 | } |
|
5870 | 5899 | } |
5871 | 5900 | } |
5872 | 5901 | } |
5873 | | - |
5874 | | - if (rtcWs && landState && landState.loaded) { |
5875 | | - for (let i = 0; i < assetMeshes.length; i++) { |
5876 | | - const moveMesh = assetMeshes[i]; |
5877 | | - const {xrIframe} = moveMesh; |
5878 | | - rtcWs.send(JSON.stringify({ |
5879 | | - method: 'editState', |
5880 | | - spec: { |
5881 | | - keyPath: [0, '#' + xrIframe.id], |
5882 | | - method: 'setAttributes', |
5883 | | - values: [ |
5884 | | - { |
5885 | | - key: 'position', |
5886 | | - value: xrIframe.getAttribute('position'), |
5887 | | - }, |
5888 | | - { |
5889 | | - key: 'orientation', |
5890 | | - value: xrIframe.getAttribute('orientation'), |
5891 | | - }, |
5892 | | - { |
5893 | | - key: 'data', |
5894 | | - value: xrIframe.getAttribute('data'), |
5895 | | - }, |
5896 | | - ], |
5897 | | - }, |
5898 | | - })); |
5899 | | - } |
5900 | | - } |
5901 | 5902 | }; |
5902 | 5903 | _updateCurrentMoveMeshes(); |
5903 | 5904 |
|
|
0 commit comments