質問編集履歴

1

javascriptコードの追記

2020/09/09 02:00

投稿

4glte
4glte

スコア4

test CHANGED
File without changes
test CHANGED
@@ -242,6 +242,128 @@
242
242
 
243
243
  ```
244
244
 
245
+ javascriptコード
246
+
247
+ ```
248
+
249
+ var iframe;
250
+
251
+ var tags;
252
+
253
+ var tagg;
254
+
255
+ var count;
256
+
257
+ count = 0;
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+ document.addEventListener('DOMContentLoaded', () => {
266
+
267
+ iframe = document.getElementById('showcase_iframe');
268
+
269
+ iframe.addEventListener('load', showcaseLoader, true);
270
+
271
+ });
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ function showcaseLoader() {
280
+
281
+ authorize();
282
+
283
+ try {
284
+
285
+ window.MP_SDK.connect(iframe, 'f2f3b17ffcdb4e99afbcc0c285a9d7c7', '3.5')
286
+
287
+ .then(loadedShowcaseHandler)
288
+
289
+ .catch(handleError);
290
+
291
+ }
292
+
293
+ catch (e) {
294
+
295
+ console.error(e);
296
+
297
+ }
298
+
299
+ }
300
+
301
+
302
+
303
+
304
+
305
+ function loadedShowcaseHandler(mpSdk) {
306
+
307
+ var popup = document.getElementById('js-popup');
308
+
309
+ var mattertagDesc = {
310
+
311
+ label: 'Hello Mattertag',
312
+
313
+ description: 'This is test',
314
+
315
+ anchorPosition: { x: 0.39, y: 1.00, z: -0.122 },
316
+
317
+ stemVector: { x: 0, y: 0, z: 0 },
318
+
319
+ color: { r: 0.0, g: 0.0, b: 1.0 },
320
+
321
+ };
322
+
323
+ mpSdk.Mattertag.add(mattertagDesc).then(function (mattertagId) {
324
+
325
+ console.log(mattertagId);
326
+
327
+ // output: TODO
328
+
329
+ });
330
+
331
+
332
+
333
+ //ここでエラーを吐いてしまいます
334
+
335
+ mpSdk.Mattertag.registerIcon('GoodBlackIconId', 'good_black.png');
336
+
337
+ mpSdk.Mattertag.registerIcon('GoodRedIconId', 'http://ec2-18-224-7-206.us-east-2.compute.amazonaws.com/html/good_red.png');
338
+
339
+
340
+
341
+ tags = mpSdk.Mattertag.getData()
342
+
343
+ .then(function (tags){
344
+
345
+ console.log(tags);
346
+
347
+ tag0 = tags[0].sid;
348
+
349
+ tag1 = tags[1].sid;
350
+
351
+ tag2 = tags[2].sid;
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+ });
364
+
365
+ ```
366
+
245
367
 
246
368
 
247
369
  ### 補足情報(FW/ツールのバージョンなど)