• R/O
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

JavaScriptを色々あれこれしようとするがひたすら失敗を繰り返している


コミットメタ情報

リビジョン47 (tree)
日時2016-12-10 15:20:49
作者takoyaki_umaaaa

ログメッセージ

・タッチイベント対応

変更サマリ

差分

--- HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/DispObj.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/DispObj.js (revision 47)
@@ -326,7 +326,7 @@
326326 window.appArea.setSingleTouchEventObj('DispBase',this.mouseMove.bind(this), this.mouseUp.bind(this));
327327 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
328328 evt.preventDefault(); // 要素既定のdefault動作を止める
329- this.startMovingElement(evt.touches[0]);
329+ this.startMovingElement(evt.targetTouches[0]);
330330 }
331331 startMovingElement(evt){
332332 /* test
@@ -354,9 +354,11 @@
354354 window.partsFocus.setClingingPartner(this.DOMbase);
355355
356356 }
357- mouseMove(evt, xy) {
358- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
359- evt.preventDefault(); // 要素既定のdefault動作を止める
357+ mouseMove(evt, touchevt) {
358+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
359+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
360+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
361+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
360362
361363 /* test
362364 let matp = matPerspective(1);
@@ -388,12 +390,14 @@
388390 this.DOMbase.style.top = y + "px";
389391 this.DOMobject.style.opacity = 0.4;
390392 }
391- mouseUp(evt, target) {
393+ mouseUp(evt, target, touchevt) {
392394 this.debuglog("mouseUp");
393395 // Mouse event処理対象をクリア
394- window.appArea.setMouseEventObj(null, null, null);
395- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
396- evt.preventDefault(); // 要素既定のdefault動作を止める
396+ window.appArea.clearCallEventObj();
397+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
398+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
399+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
400+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
397401
398402
399403 // 移動元として座標を保持
--- HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/UI_parts.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/UI_parts.js (revision 47)
@@ -197,7 +197,7 @@
197197 evt.preventDefault(); // 要素既定のdefault動作を止める
198198 // Mouse eventをappAreaからScalerに渡してもらうように設定
199199 window.appArea.setSingleTouchEventObj(null, this.mouseMoveScale.bind(this), this.mouseUpScale.bind(this));
200- this.startScaling(evt.touches[0]);
200+ this.startScaling(evt.targetTouches[0]);
201201 }
202202 startScaling(evt){
203203 let eleFocus = this.getFocusdElements();
@@ -219,11 +219,13 @@
219219 this.startDragX = tmp2[0];
220220 this.startDragY = tmp1[1];
221221 }
222- mouseMoveScale(evt) {
222+ mouseMoveScale(evt, touchevt) {
223223 let eleFocus = this.getFocusdElements();
224224 if (eleFocus.length < 2) return;
225- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
226- evt.preventDefault(); // 要素既定のdefault動作を止める
225+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
226+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
227+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
228+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
227229
228230 // 画像を反転している場合、マウス入力座標も反転させる
229231 // let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
@@ -338,15 +340,17 @@
338340 eleFocus[1].style.fontSize = scalefont + '%';
339341 }
340342
341- mouseUpScale(evt) {
343+ mouseUpScale(evt, target, touchevt) {
342344 this.debuglog('mouseUpScale');
343345 // Mouse event callback設定をクリア
344- window.appArea.setMouseEventObj(null, null, null);
346+ window.appArea.clearCallEventObj();
345347
346348 let eleFocus = this.getFocusdElements();
347349 if (eleFocus.length < 2) return;
348- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
349- evt.preventDefault(); // 要素既定のdefault動作を止める
350+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
351+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
352+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
353+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
350354
351355 let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY);
352356 let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]);
@@ -411,7 +415,7 @@
411415 evt.preventDefault(); // 要素既定のdefault動作を止める
412416 // Mouse eventをappAreaからRollerに渡してもらうように設定
413417 window.appArea.setSingleTouchEventObj(null, this.mouseMoveRoll.bind(this), this.mouseUpRoll.bind(this));
414- this.startRolling(evt.touches[0]);
418+ this.startRolling(evt.targetTouches[0]);
415419 }
416420 startRolling(evt){
417421 let eleFocus = this.getFocusdElements();
@@ -421,11 +425,13 @@
421425 this.degUD = parseInt(eleFocus[0].dataset.mirrorud);
422426 this.degLR = parseInt(eleFocus[0].dataset.mirrorlr);
423427 }
424- mouseMoveRoll(evt) {
428+ mouseMoveRoll(evt, touchevt) {
425429 let eleFocus = this.getFocusdElements();
426430 if (eleFocus.length < 2) return;
427- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
428- evt.preventDefault(); // 要素既定のdefault動作を止める
431+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
432+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
433+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
434+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
429435
430436 // let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
431437 // let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2;
@@ -447,14 +453,16 @@
447453
448454 eleFocus[0].style.transform = 'rotateY(' + mirrorlr + 'deg) rotateX(' + mirrorud + 'deg) rotateZ(' + degree + 'deg)';
449455 }
450- mouseUpRoll(evt) {
456+ mouseUpRoll(evt, target, touchevt) {
451457 this.debuglog('mouseUpRoll');
452458 // Mouse event callback設定をクリア
453- window.appArea.setMouseEventObj(null, null, null);
459+ window.appArea.clearCallEventObj();
454460 let eleFocus = this.getFocusdElements();
455461 if (eleFocus.length < 2) return;
456- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
457- evt.preventDefault(); // 要素既定のdefault動作を止める
462+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
463+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
464+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
465+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
458466
459467 let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
460468 let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2;
@@ -490,22 +498,26 @@
490498 // Mouse eventをappAreaからRollerに渡してもらうように設定
491499 window.appArea.setSingleTouchEventObj(null, this.mouseMoveMirror.bind(this), this.mouseUpMirror.bind(this));
492500 }
493- mouseMoveMirror(evt) {
501+ mouseMoveMirror(evt, touchevt) {
494502 let eleFocus = this.getFocusdElements();
495503 if (eleFocus.length < 2) return;
496- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
497- evt.preventDefault(); // 要素既定のdefault動作を止める
504+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
505+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
506+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
507+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
498508
499509 // 画像反転させるだけなのでmouse moveは処理しない
500510 }
501- mouseUpMirror(evt, target) {
511+ mouseUpMirror(evt, target, touchevt) {
502512 this.debuglog('mouseUpMirror');
503513 // Mouse event callback設定をクリア
504- window.appArea.setMouseEventObj(null, null, null);
514+ window.appArea.clearCallEventObj();
505515 let eleFocus = this.getFocusdElements();
506516 if (eleFocus.length < 2) return;
507- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
508- evt.preventDefault(); // 要素既定のdefault動作を止める
517+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
518+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
519+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
520+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
509521
510522 let command = -1;
511523 switch (evt.target.dataset.objid) {
--- HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/apparea.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/apparea.js (revision 47)
@@ -30,6 +30,9 @@
3030 this.DOMobject.addEventListener('touchmove', this.onTouchMove.bind(this), false);
3131 this.DOMobject.addEventListener('touchstart', this.onTouchStart.bind(this), false);
3232 this.DOMobject.addEventListener('touchend', this.onTouchEnd.bind(this), false);
33+ this.DOMobject.addEventListener('dragstart', prohibitDropHandler_dragStart.bind(this), false);
34+ this.DOMobject.addEventListener('dragover', prohibitDropHandler_dragOver.bind(this), false);
35+ this.DOMobject.addEventListener('drop', prohibitDropHandler_drop.bind(this), false);
3336 }
3437
3538
@@ -121,7 +124,7 @@
121124 // Callbackを上書きしてしまう場合はエラー出力し、ひとまず処理を継続
122125 if (null != touchMove || null != touchEnd) {
123126 if (null != this.touchMoveFunc || null != this.touchEndFunc) {
124- console.error('マウスイベント callback設定上書き \n\
127+ console.error('タッチイベント callback設定上書き \n\
125128 Before strclass=' + this.strclass + 'callbackMove=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', callbackUp=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null') + '\n\
126129 After strclass=' + strclass + 'callbackMove=' + ((null != touchMove) ? touchMove.name : 'null') + ', callbackUp=' + ((null != touchEnd) ? touchEnd.name : 'null'));
127130 }
@@ -132,6 +135,15 @@
132135 this.touchEndFunc = touchEnd;
133136 }
134137
138+ // 設定クリア
139+ clearCallEventObj() {
140+ this.debuglog('マウスとタッチ イベント転送設定クリア');
141+ this.strclass = null;
142+ this.mouseMoveFunc = null;
143+ this.mouseUpFunc = null;
144+ this.touchMoveFunc = null;
145+ this.touchEndFunc = null;
146+ }
135147 // Event handler -------------------
136148
137149 // マウス左ボタン押下 (Drag処理)
@@ -150,7 +162,7 @@
150162 }
151163 onTouchMove(evt){
152164 if (null != this.touchMoveFunc) {
153- this.touchMoveFunc(evt.touches[0]);
165+ this.touchMoveFunc(evt.targetTouches[0], evt);
154166 }
155167 }
156168
@@ -169,7 +181,7 @@
169181 }
170182 onTouchEnd(evt){
171183 this.debuglog('タッチエンド onTouchEnd() findClass=' + this.strclass + ', callback move=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', End=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null'));
172- let e = findClassNameParent(this.strclass, evt.touches[0].target);
184+ let e = findClassNameParent(this.strclass, evt.changedTouches[0].target);
173185 if (null == e) {
174186 console.error('入力完了処理 指定要素が見つからない findClass=' + this.strclass + ', callback move=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', End=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null'));
175187 // ひとまず処理を継続する
@@ -176,7 +188,7 @@
176188 }
177189
178190 if (null != this.touchEndFunc) {
179- this.touchEndFunc(evt.touches[0], e);
191+ this.touchEndFunc(evt.changedTouches[0], e, evt);
180192 }
181193 }
182194
--- HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/palette.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/palette.js (revision 47)
@@ -225,7 +225,7 @@
225225 evt.preventDefault(); // 要素既定のdefault動作を止める
226226 // Mouse eventをappAreaからCSSPalに渡してもらうように設定 (evt.targetは必ずpalette要素である前提。子要素なし。)
227227 window.appArea.setSingleTouchEventObj(evt.target.dataset.objid, this.mouseMove.bind(this), this.mouseUp.bind(this));
228- this.startMovingElement(evt.touches[0]);
228+ this.startMovingElement(evt.targetTouches[0]);
229229 }
230230 startMovingElement(evt){
231231 // Drag対象を保持
@@ -237,10 +237,12 @@
237237 this.startDragX = evt.pageX;
238238 this.startDragY = evt.pageY;
239239 }
240- mouseMove(evt) {
240+ mouseMove(evt, touchevt) {
241241 if (null == this.draggingDOM) return;
242- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
243- evt.preventDefault(); // 要素既定のdefault動作を止める
242+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
243+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
244+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
245+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
244246
245247 // 画像の仮移動
246248 this.endDragX = evt.pageX;
@@ -263,10 +265,12 @@
263265 if (1.0 == this.draggingDOM.style.opacity)
264266 this.draggingDOM.style.opacity = 0.4;
265267 }
266- mouseUp(evt) {
268+ mouseUp(evt, target, touchevt) {
267269 if (null == this.draggingDOM) return;
268- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
269- evt.preventDefault(); // 要素既定のdefault動作を止める
270+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
271+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
272+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
273+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
270274 this.endMovingElement(evt);
271275 }
272276 touchEnd(evt) {
@@ -273,7 +277,7 @@
273277 if (null == this.draggingDOM) return;
274278 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
275279 evt.preventDefault(); // 要素既定のdefault動作を止める
276- this.endMovingElement(evt.touches[0]);
280+ this.endMovingElement(evt.changedTouches[0]);
277281 }
278282 endMovingElement(evt){
279283 let palobjid = this.draggingDOM.dataset.objid;
@@ -287,7 +291,7 @@
287291 // Drag中 element情報をクリア
288292 this.draggingDOM = null;
289293 // Mouse event callback設定をクリア
290- window.appArea.setMouseEventObj(null, null, null);
294+ window.appArea.clearCallEventObj();
291295
292296 // マウス座標直下にある要素を検索
293297 // (evt.targetは自分を指してしまうため)
@@ -339,15 +343,17 @@
339343 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
340344 evt.preventDefault(); // 要素既定のdefault動作を止める
341345 }
342- mouseUpSetting(evt) {
343- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
344- evt.preventDefault(); // 要素既定のdefault動作を止める
346+ mouseUpSetting(evt, touchevt) {
347+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
348+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
349+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
350+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
345351 this.executeSettingButton(evt);
346352 }
347353 touchEndSetting(evt){
348354 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
349355 evt.preventDefault(); // 要素既定のdefault動作を止める
350- this.executeSettingButton(evt.touches[0]);
356+ this.executeSettingButton(evt.changedTouches[0]);
351357 }
352358 executeSettingButton(evt){
353359 switch (evt.target.dataset.objid) {
--- HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/palgroup.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/bin/x64/Debug/AppX/js/palgroup.js (revision 47)
@@ -30,6 +30,9 @@
3030 this.DOMobject[cnt].addEventListener('mouseup', this.mouseUp.bind(this), false);
3131 this.DOMobject[cnt].addEventListener('touchstart', this.onTouchStart.bind(this), false);
3232 this.DOMobject[cnt].addEventListener('touchend', this.touchEnd.bind(this), false);
33+ this.DOMobject[cnt].addEventListener('dragstart', prohibitDropHandler_dragStart.bind(this), false);
34+ this.DOMobject[cnt].addEventListener('dragover', prohibitDropHandler_dragOver.bind(this), false);
35+ this.DOMobject[cnt].addEventListener('drop', prohibitDropHandler_drop.bind(this), false);
3336 }
3437 }
3538
@@ -55,8 +58,8 @@
5558 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
5659 evt.preventDefault(); // 要素既定のdefault動作を止める
5760 // Mouse eventをappAreaからCSSPalに渡してもらうように設定
58- window.appArea.setMouseEventObj('palgroup', this.touchMove.bind(this), null);
59- this.startMovingPalette(evt.touches[0].target, evt.touches[0].pageX, evt.touches[0].pageY);
61+ window.appArea.setSingleTouchEventObj('palgroup', this.mouseMove.bind(this), null);
62+ this.startMovingPalette(evt.targetTouches[0].target, evt.targetTouches[0].pageX, evt.targetTouches[0].pageY);
6063 }
6164 startMovingPalette(eletarget, x, y){
6265
@@ -75,22 +78,16 @@
7578 this.startDragX = x;
7679 this.startDragY = y;
7780 }
78- mouseMove(evt) {
81+ mouseMove(evt, touchevt) {
7982 if (null == this.draggingDOM) return;
80- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
81- evt.preventDefault(); // 要素既定のdefault動作を止める
82- this.movingPalette(evt.target, evt.pageX, evt.pageY);
83- }
84- touchMove(evt) {
85- if (null == this.draggingDOM) return;
86- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
87- evt.preventDefault(); // 要素既定のdefault動作を止める
88- this.movingPalette(evt.touches[0].target, evt.touches[0].pageX, evt.touches[0].pageY);
89- }
90- movingPalette(eletarget, x, y) {
83+ if (evt.stopPropagation ) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
84+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
85+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
86+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
87+
9188 // 画像の仮移動
92- this.endDragX = x;
93- this.endDragY = y;
89+ this.endDragX = evt.pageX;
90+ this.endDragY = evt.pageY;
9491 // 移動量取得
9592 let moveX = this.endDragX - this.startDragX;
9693 let moveY = this.endDragY - this.startDragY;
@@ -113,7 +110,7 @@
113110 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
114111 evt.preventDefault(); // 要素既定のdefault動作を止める
115112 // Mouse event callback設定をクリア
116- window.appArea.setMouseEventObj(null, null, null);
113+ window.appArea.clearCallEventObj();
117114 this.endMovingPalette();
118115 }
119116 touchEnd(evt) {
@@ -121,7 +118,7 @@
121118 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
122119 evt.preventDefault(); // 要素既定のdefault動作を止める
123120 // Mouse event callback設定をクリア
124- window.appArea.setMouseEventObj(null, null, null);
121+ window.appArea.clearCallEventObj();
125122 this.endMovingPalette();
126123 }
127124 endMovingPalette(){
--- HtmlDrawApp/HTMLDrawApp/index.html (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/index.html (revision 47)
@@ -218,6 +218,7 @@
218218 </div> <!-- apparea -->
219219
220220 <script type="text/javascript" src="js/numeric-1.2.6.min.js"></script>
221+ <script type="text/javascript" src="js/settings.js"></script>
221222 <script type="text/javascript" src="js/Common.js"></script>
222223 <script type="text/javascript" src="js/Queue.js"></script>
223224 <script type="text/javascript" src="js/CommandObj.js"></script>
--- HtmlDrawApp/HTMLDrawApp/js/DispObj.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/js/DispObj.js (revision 47)
@@ -326,7 +326,7 @@
326326 window.appArea.setSingleTouchEventObj('DispBase',this.mouseMove.bind(this), this.mouseUp.bind(this));
327327 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
328328 evt.preventDefault(); // 要素既定のdefault動作を止める
329- this.startMovingElement(evt.touches[0]);
329+ this.startMovingElement(evt.targetTouches[0]);
330330 }
331331 startMovingElement(evt){
332332 /* test
@@ -354,9 +354,11 @@
354354 window.partsFocus.setClingingPartner(this.DOMbase);
355355
356356 }
357- mouseMove(evt, xy) {
358- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
359- evt.preventDefault(); // 要素既定のdefault動作を止める
357+ mouseMove(evt, touchevt) {
358+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
359+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
360+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
361+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
360362
361363 /* test
362364 let matp = matPerspective(1);
@@ -388,12 +390,14 @@
388390 this.DOMbase.style.top = y + "px";
389391 this.DOMobject.style.opacity = 0.4;
390392 }
391- mouseUp(evt, target) {
393+ mouseUp(evt, target, touchevt) {
392394 this.debuglog("mouseUp");
393395 // Mouse event処理対象をクリア
394- window.appArea.setMouseEventObj(null, null, null);
395- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
396- evt.preventDefault(); // 要素既定のdefault動作を止める
396+ window.appArea.clearCallEventObj();
397+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
398+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
399+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
400+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
397401
398402
399403 // 移動元として座標を保持
--- HtmlDrawApp/HTMLDrawApp/js/UI_parts.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/js/UI_parts.js (revision 47)
@@ -197,7 +197,7 @@
197197 evt.preventDefault(); // 要素既定のdefault動作を止める
198198 // Mouse eventをappAreaからScalerに渡してもらうように設定
199199 window.appArea.setSingleTouchEventObj(null, this.mouseMoveScale.bind(this), this.mouseUpScale.bind(this));
200- this.startScaling(evt.touches[0]);
200+ this.startScaling(evt.targetTouches[0]);
201201 }
202202 startScaling(evt){
203203 let eleFocus = this.getFocusdElements();
@@ -219,11 +219,13 @@
219219 this.startDragX = tmp2[0];
220220 this.startDragY = tmp1[1];
221221 }
222- mouseMoveScale(evt) {
222+ mouseMoveScale(evt, touchevt) {
223223 let eleFocus = this.getFocusdElements();
224224 if (eleFocus.length < 2) return;
225- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
226- evt.preventDefault(); // 要素既定のdefault動作を止める
225+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
226+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
227+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
228+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
227229
228230 // 画像を反転している場合、マウス入力座標も反転させる
229231 // let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
@@ -338,15 +340,17 @@
338340 eleFocus[1].style.fontSize = scalefont + '%';
339341 }
340342
341- mouseUpScale(evt) {
343+ mouseUpScale(evt, target, touchevt) {
342344 this.debuglog('mouseUpScale');
343345 // Mouse event callback設定をクリア
344- window.appArea.setMouseEventObj(null, null, null);
346+ window.appArea.clearCallEventObj();
345347
346348 let eleFocus = this.getFocusdElements();
347349 if (eleFocus.length < 2) return;
348- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
349- evt.preventDefault(); // 要素既定のdefault動作を止める
350+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
351+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
352+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
353+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
350354
351355 let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY);
352356 let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]);
@@ -411,7 +415,7 @@
411415 evt.preventDefault(); // 要素既定のdefault動作を止める
412416 // Mouse eventをappAreaからRollerに渡してもらうように設定
413417 window.appArea.setSingleTouchEventObj(null, this.mouseMoveRoll.bind(this), this.mouseUpRoll.bind(this));
414- this.startRolling(evt.touches[0]);
418+ this.startRolling(evt.targetTouches[0]);
415419 }
416420 startRolling(evt){
417421 let eleFocus = this.getFocusdElements();
@@ -421,11 +425,13 @@
421425 this.degUD = parseInt(eleFocus[0].dataset.mirrorud);
422426 this.degLR = parseInt(eleFocus[0].dataset.mirrorlr);
423427 }
424- mouseMoveRoll(evt) {
428+ mouseMoveRoll(evt, touchevt) {
425429 let eleFocus = this.getFocusdElements();
426430 if (eleFocus.length < 2) return;
427- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
428- evt.preventDefault(); // 要素既定のdefault動作を止める
431+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
432+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
433+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
434+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
429435
430436 // let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
431437 // let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2;
@@ -447,14 +453,16 @@
447453
448454 eleFocus[0].style.transform = 'rotateY(' + mirrorlr + 'deg) rotateX(' + mirrorud + 'deg) rotateZ(' + degree + 'deg)';
449455 }
450- mouseUpRoll(evt) {
456+ mouseUpRoll(evt, target, touchevt) {
451457 this.debuglog('mouseUpRoll');
452458 // Mouse event callback設定をクリア
453- window.appArea.setMouseEventObj(null, null, null);
459+ window.appArea.clearCallEventObj();
454460 let eleFocus = this.getFocusdElements();
455461 if (eleFocus.length < 2) return;
456- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
457- evt.preventDefault(); // 要素既定のdefault動作を止める
462+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
463+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
464+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
465+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
458466
459467 let x1 = parseInt(eleFocus[0].style.left) + parseInt(eleFocus[0].style.width) / 2;
460468 let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2;
@@ -490,22 +498,26 @@
490498 // Mouse eventをappAreaからRollerに渡してもらうように設定
491499 window.appArea.setSingleTouchEventObj(null, this.mouseMoveMirror.bind(this), this.mouseUpMirror.bind(this));
492500 }
493- mouseMoveMirror(evt) {
501+ mouseMoveMirror(evt, touchevt) {
494502 let eleFocus = this.getFocusdElements();
495503 if (eleFocus.length < 2) return;
496- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
497- evt.preventDefault(); // 要素既定のdefault動作を止める
504+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
505+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
506+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
507+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
498508
499509 // 画像反転させるだけなのでmouse moveは処理しない
500510 }
501- mouseUpMirror(evt, target) {
511+ mouseUpMirror(evt, target, touchevt) {
502512 this.debuglog('mouseUpMirror');
503513 // Mouse event callback設定をクリア
504- window.appArea.setMouseEventObj(null, null, null);
514+ window.appArea.clearCallEventObj();
505515 let eleFocus = this.getFocusdElements();
506516 if (eleFocus.length < 2) return;
507- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
508- evt.preventDefault(); // 要素既定のdefault動作を止める
517+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
518+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
519+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
520+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
509521
510522 let command = -1;
511523 switch (evt.target.dataset.objid) {
--- HtmlDrawApp/HTMLDrawApp/js/apparea.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/js/apparea.js (revision 47)
@@ -30,6 +30,9 @@
3030 this.DOMobject.addEventListener('touchmove', this.onTouchMove.bind(this), false);
3131 this.DOMobject.addEventListener('touchstart', this.onTouchStart.bind(this), false);
3232 this.DOMobject.addEventListener('touchend', this.onTouchEnd.bind(this), false);
33+ this.DOMobject.addEventListener('dragstart', prohibitDropHandler_dragStart.bind(this), false);
34+ this.DOMobject.addEventListener('dragover', prohibitDropHandler_dragOver.bind(this), false);
35+ this.DOMobject.addEventListener('drop', prohibitDropHandler_drop.bind(this), false);
3336 }
3437
3538
@@ -121,7 +124,7 @@
121124 // Callbackを上書きしてしまう場合はエラー出力し、ひとまず処理を継続
122125 if (null != touchMove || null != touchEnd) {
123126 if (null != this.touchMoveFunc || null != this.touchEndFunc) {
124- console.error('マウスイベント callback設定上書き \n\
127+ console.error('タッチイベント callback設定上書き \n\
125128 Before strclass=' + this.strclass + 'callbackMove=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', callbackUp=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null') + '\n\
126129 After strclass=' + strclass + 'callbackMove=' + ((null != touchMove) ? touchMove.name : 'null') + ', callbackUp=' + ((null != touchEnd) ? touchEnd.name : 'null'));
127130 }
@@ -132,6 +135,15 @@
132135 this.touchEndFunc = touchEnd;
133136 }
134137
138+ // 設定クリア
139+ clearCallEventObj() {
140+ this.debuglog('マウスとタッチ イベント転送設定クリア');
141+ this.strclass = null;
142+ this.mouseMoveFunc = null;
143+ this.mouseUpFunc = null;
144+ this.touchMoveFunc = null;
145+ this.touchEndFunc = null;
146+ }
135147 // Event handler -------------------
136148
137149 // マウス左ボタン押下 (Drag処理)
@@ -150,7 +162,7 @@
150162 }
151163 onTouchMove(evt){
152164 if (null != this.touchMoveFunc) {
153- this.touchMoveFunc(evt.touches[0]);
165+ this.touchMoveFunc(evt.targetTouches[0], evt);
154166 }
155167 }
156168
@@ -169,7 +181,7 @@
169181 }
170182 onTouchEnd(evt){
171183 this.debuglog('タッチエンド onTouchEnd() findClass=' + this.strclass + ', callback move=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', End=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null'));
172- let e = findClassNameParent(this.strclass, evt.touches[0].target);
184+ let e = findClassNameParent(this.strclass, evt.changedTouches[0].target);
173185 if (null == e) {
174186 console.error('入力完了処理 指定要素が見つからない findClass=' + this.strclass + ', callback move=' + (this.touchMoveFunc ? this.touchMoveFunc.name : 'null') + ', End=' + (this.touchEndFunc ? this.touchEndFunc.name : 'null'));
175187 // ひとまず処理を継続する
@@ -176,7 +188,7 @@
176188 }
177189
178190 if (null != this.touchEndFunc) {
179- this.touchEndFunc(evt.touches[0], e);
191+ this.touchEndFunc(evt.changedTouches[0], e, evt);
180192 }
181193 }
182194
--- HtmlDrawApp/HTMLDrawApp/js/palette.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/js/palette.js (revision 47)
@@ -225,7 +225,7 @@
225225 evt.preventDefault(); // 要素既定のdefault動作を止める
226226 // Mouse eventをappAreaからCSSPalに渡してもらうように設定 (evt.targetは必ずpalette要素である前提。子要素なし。)
227227 window.appArea.setSingleTouchEventObj(evt.target.dataset.objid, this.mouseMove.bind(this), this.mouseUp.bind(this));
228- this.startMovingElement(evt.touches[0]);
228+ this.startMovingElement(evt.targetTouches[0]);
229229 }
230230 startMovingElement(evt){
231231 // Drag対象を保持
@@ -237,10 +237,12 @@
237237 this.startDragX = evt.pageX;
238238 this.startDragY = evt.pageY;
239239 }
240- mouseMove(evt) {
240+ mouseMove(evt, touchevt) {
241241 if (null == this.draggingDOM) return;
242- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
243- evt.preventDefault(); // 要素既定のdefault動作を止める
242+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
243+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
244+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
245+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
244246
245247 // 画像の仮移動
246248 this.endDragX = evt.pageX;
@@ -263,10 +265,12 @@
263265 if (1.0 == this.draggingDOM.style.opacity)
264266 this.draggingDOM.style.opacity = 0.4;
265267 }
266- mouseUp(evt) {
268+ mouseUp(evt, target, touchevt) {
267269 if (null == this.draggingDOM) return;
268- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
269- evt.preventDefault(); // 要素既定のdefault動作を止める
270+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
271+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
272+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
273+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
270274 this.endMovingElement(evt);
271275 }
272276 touchEnd(evt) {
@@ -273,7 +277,7 @@
273277 if (null == this.draggingDOM) return;
274278 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
275279 evt.preventDefault(); // 要素既定のdefault動作を止める
276- this.endMovingElement(evt.touches[0]);
280+ this.endMovingElement(evt.changedTouches[0]);
277281 }
278282 endMovingElement(evt){
279283 let palobjid = this.draggingDOM.dataset.objid;
@@ -287,7 +291,7 @@
287291 // Drag中 element情報をクリア
288292 this.draggingDOM = null;
289293 // Mouse event callback設定をクリア
290- window.appArea.setMouseEventObj(null, null, null);
294+ window.appArea.clearCallEventObj();
291295
292296 // マウス座標直下にある要素を検索
293297 // (evt.targetは自分を指してしまうため)
@@ -339,15 +343,17 @@
339343 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
340344 evt.preventDefault(); // 要素既定のdefault動作を止める
341345 }
342- mouseUpSetting(evt) {
343- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
344- evt.preventDefault(); // 要素既定のdefault動作を止める
346+ mouseUpSetting(evt, touchevt) {
347+ if (evt.stopPropagation) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
348+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
349+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
350+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
345351 this.executeSettingButton(evt);
346352 }
347353 touchEndSetting(evt){
348354 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
349355 evt.preventDefault(); // 要素既定のdefault動作を止める
350- this.executeSettingButton(evt.touches[0]);
356+ this.executeSettingButton(evt.changedTouches[0]);
351357 }
352358 executeSettingButton(evt){
353359 switch (evt.target.dataset.objid) {
--- HtmlDrawApp/HTMLDrawApp/js/palgroup.js (revision 46)
+++ HtmlDrawApp/HTMLDrawApp/js/palgroup.js (revision 47)
@@ -30,6 +30,9 @@
3030 this.DOMobject[cnt].addEventListener('mouseup', this.mouseUp.bind(this), false);
3131 this.DOMobject[cnt].addEventListener('touchstart', this.onTouchStart.bind(this), false);
3232 this.DOMobject[cnt].addEventListener('touchend', this.touchEnd.bind(this), false);
33+ this.DOMobject[cnt].addEventListener('dragstart', prohibitDropHandler_dragStart.bind(this), false);
34+ this.DOMobject[cnt].addEventListener('dragover', prohibitDropHandler_dragOver.bind(this), false);
35+ this.DOMobject[cnt].addEventListener('drop', prohibitDropHandler_drop.bind(this), false);
3336 }
3437 }
3538
@@ -55,8 +58,8 @@
5558 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
5659 evt.preventDefault(); // 要素既定のdefault動作を止める
5760 // Mouse eventをappAreaからCSSPalに渡してもらうように設定
58- window.appArea.setMouseEventObj('palgroup', this.touchMove.bind(this), null);
59- this.startMovingPalette(evt.touches[0].target, evt.touches[0].pageX, evt.touches[0].pageY);
61+ window.appArea.setSingleTouchEventObj('palgroup', this.mouseMove.bind(this), null);
62+ this.startMovingPalette(evt.targetTouches[0].target, evt.targetTouches[0].pageX, evt.targetTouches[0].pageY);
6063 }
6164 startMovingPalette(eletarget, x, y){
6265
@@ -75,22 +78,16 @@
7578 this.startDragX = x;
7679 this.startDragY = y;
7780 }
78- mouseMove(evt) {
81+ mouseMove(evt, touchevt) {
7982 if (null == this.draggingDOM) return;
80- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
81- evt.preventDefault(); // 要素既定のdefault動作を止める
82- this.movingPalette(evt.target, evt.pageX, evt.pageY);
83- }
84- touchMove(evt) {
85- if (null == this.draggingDOM) return;
86- evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
87- evt.preventDefault(); // 要素既定のdefault動作を止める
88- this.movingPalette(evt.touches[0].target, evt.touches[0].pageX, evt.touches[0].pageY);
89- }
90- movingPalette(eletarget, x, y) {
83+ if (evt.stopPropagation ) evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
84+ if (evt.preventDefault) evt.preventDefault(); // 要素既定のdefault動作を止める
85+ if (touchevt && touchevt.stopPropagation) touchevt.stopPropagation();
86+ if (touchevt && touchevt.preventDefault) touchevt.preventDefault();
87+
9188 // 画像の仮移動
92- this.endDragX = x;
93- this.endDragY = y;
89+ this.endDragX = evt.pageX;
90+ this.endDragY = evt.pageY;
9491 // 移動量取得
9592 let moveX = this.endDragX - this.startDragX;
9693 let moveY = this.endDragY - this.startDragY;
@@ -113,7 +110,7 @@
113110 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
114111 evt.preventDefault(); // 要素既定のdefault動作を止める
115112 // Mouse event callback設定をクリア
116- window.appArea.setMouseEventObj(null, null, null);
113+ window.appArea.clearCallEventObj();
117114 this.endMovingPalette();
118115 }
119116 touchEnd(evt) {
@@ -121,7 +118,7 @@
121118 evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる)
122119 evt.preventDefault(); // 要素既定のdefault動作を止める
123120 // Mouse event callback設定をクリア
124- window.appArea.setMouseEventObj(null, null, null);
121+ window.appArea.clearCallEventObj();
125122 this.endMovingPalette();
126123 }
127124 endMovingPalette(){