JavaScriptを色々あれこれしようとするがひたすら失敗を繰り返している
| Revision | 41 (tree) |
|---|---|
| Time | 2016-12-04 17:06:05 |
| Author | |
・要素回転後のマウス操作追従 - 途中
| @@ -192,13 +192,9 @@ | ||
| 192 | 192 | this.y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2; |
| 193 | 193 | this.degUD = parseInt(eleFocus[0].dataset.mirrorud); |
| 194 | 194 | this.degLR = parseInt(eleFocus[0].dataset.mirrorlr); |
| 195 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 196 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 197 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 198 | - // x2 = tmp2[0]; | |
| 199 | - // y2 = tmp1[1]; | |
| 200 | - // x2 = tmp3[0]; | |
| 201 | - // y2 = tmp3[1]; | |
| 195 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 196 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 197 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 202 | 198 | // ------------ |
| 203 | 199 | |
| 204 | 200 | // 移動元として座標を保持 |
| @@ -220,11 +216,9 @@ | ||
| 220 | 216 | // let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2; |
| 221 | 217 | // let degUD = parseInt(eleFocus[0].dataset.mirrorud); |
| 222 | 218 | // let degLR = parseInt(eleFocus[0].dataset.mirrorlr); |
| 223 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 224 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 225 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 226 | - // x2 = tmp3[0]; | |
| 227 | - // y2 = tmp3[1]; | |
| 219 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 220 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 221 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 228 | 222 | // ------------ |
| 229 | 223 | |
| 230 | 224 |
| @@ -238,6 +232,53 @@ | ||
| 238 | 232 | let mirrorCodUD = (this.degUD) ? -1 : 0; |
| 239 | 233 | let mirrorCodLR = (this.degLR) ? -1 : 0; |
| 240 | 234 | |
| 235 | +/* | |
| 236 | + let resultLeft = this.scaleStartLeft; | |
| 237 | + let resultTop = this.scaleStartTop; | |
| 238 | + let resultRight = this.scaleStartLeft + (this.scaleStartWidth + moveX); | |
| 239 | + let resultBottom = this.scaleStartTop + (this.scaleStartHeight + moveY); | |
| 240 | + let resultLT = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, resultLeft, resultTop); | |
| 241 | + let resultRB = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, resultRight, resultBottom); | |
| 242 | +*/ | |
| 243 | + /* | |
| 244 | + width, heightを増減させたときの transform-origin相当の設定を変化させる必要がある | |
| 245 | + 座標指定は常に左上基準になっており、これを変更することができない | |
| 246 | + 回転させたときに左上位置が見た目上の座標系と物理的座標系でずれてしまうことで | |
| 247 | + 操作と表示にずれが発生している | |
| 248 | + | |
| 249 | + Math.cos(degToRad(degree)) | |
| 250 | +cos y座標の増分に対して | |
| 251 | +1 0度 : y + 0% height + 100% x + 0% width + 0% height | |
| 252 | +0 90度 : y + 0% height + 0% x + 0% width + 100% width | |
| 253 | +-1 180度 : y + -100% height + 0% x + 0% width + 0% y | |
| 254 | +0 270度 : y + 0% height + 0% x + -100% width + 0% x | |
| 255 | +1 360度 : y + 0% height + 100% x + 0% width + 0% height | |
| 256 | + y1 = y増分 * cos(theta) x1 = y増分 * sin(theta) | |
| 257 | + ~~~~~\ | |
| 258 | + yの変化量にsinを掛ける | |
| 259 | + | |
| 260 | +sin x座標の増分に対して | |
| 261 | +0 0度 : x + 0% width + 100% | |
| 262 | +1 90度 : | |
| 263 | +0 180度 : x + -100% width + 0% | |
| 264 | +-1 270度 : | |
| 265 | +0 360度 : | |
| 266 | + y2 = x増分 * cos(theta) x2 = x増分 * sin(theta) | |
| 267 | + | |
| 268 | + ((x1+x2),(y1+y2)) | |
| 269 | + | |
| 270 | + x1 y1 x2, y2 | |
| 271 | + ( 0, 0)-(増分x,増分y) に対してrotateZ(degree) すればいい? | |
| 272 | + 算出結果 x1',y1'-x2',y2'をleft,top,right,bottomに加算? | |
| 273 | + */ | |
| 274 | + let deg = parseFloat(eleFocus[0].dataset.degree) * -1; | |
| 275 | + let resultLT = rotateZ(0, 0, deg, 0, 0); | |
| 276 | + | |
| 277 | + let resultRB = rotateZ(0, 0, deg, moveX, moveY); | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 241 | 282 | switch (1) { |
| 242 | 283 | case 0: // 領域サイズ変更のみ |
| 243 | 284 | window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartWidth + moveX, this.scaleStartHeight + moveY)); |
| @@ -246,7 +287,8 @@ | ||
| 246 | 287 | { |
| 247 | 288 | let orgheight = parseInt(eleFocus[1].dataset.orgheight); |
| 248 | 289 | let scaleY = (this.scaleStartHeight + moveY) / orgheight * 100; // ★さらに初期倍率設定値を掛ける必要がある |
| 249 | - window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY, scaleY)); | |
| 290 | +// window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY, scaleY)); | |
| 291 | + window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + resultLT[0], this.scaleStartTop + resultLT[1], this.scaleStartWidth + resultRB[0], this.scaleStartHeight + resultRB[1], scaleY)); | |
| 250 | 292 | } |
| 251 | 293 | break; |
| 252 | 294 | } |
| @@ -270,6 +312,18 @@ | ||
| 270 | 312 | break; |
| 271 | 313 | } |
| 272 | 314 | } |
| 315 | + renderMouseMoveScaleLTRB(left, top, right, bottom, scalefont) { | |
| 316 | + let eleFocus = this.getFocusdElements(); | |
| 317 | + if (eleFocus.length < 2) return; | |
| 318 | + eleFocus[1].style.opacity = 0.4; | |
| 319 | + | |
| 320 | + eleFocus[0].style.left = left + "px"; | |
| 321 | + eleFocus[0].style.top = top + "px"; | |
| 322 | + eleFocus[0].style.right = right + "px"; | |
| 323 | + eleFocus[0].style.bottom = bottom + "px"; | |
| 324 | + eleFocus[1].style.fontSize = scalefont + '%'; | |
| 325 | + } | |
| 326 | + | |
| 273 | 327 | mouseUpScale(evt) { |
| 274 | 328 | this.debuglog('mouseUpScale'); |
| 275 | 329 | // Mouse event callback設定をクリア |
| @@ -280,9 +334,9 @@ | ||
| 280 | 334 | evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる) |
| 281 | 335 | evt.preventDefault(); // 要素既定のdefault動作を止める |
| 282 | 336 | |
| 283 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 284 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 285 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 337 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 338 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 339 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 286 | 340 | |
| 287 | 341 | // 画像の仮変形 |
| 288 | 342 | this.endDragX = tmp2[0]; |
| @@ -294,10 +348,17 @@ | ||
| 294 | 348 | let mirrorCodUD = (this.degUD) ? -1 : 0; |
| 295 | 349 | let mirrorCodLR = (this.degLR) ? -1 : 0; |
| 296 | 350 | |
| 351 | + | |
| 352 | + let deg = parseFloat(eleFocus[0].dataset.degree) * -1; | |
| 353 | + let resultLT = rotateZ(0, 0, deg, 0, 0); | |
| 354 | + let resultRB = rotateZ(0, 0, deg, moveX, moveY); | |
| 355 | + | |
| 356 | + | |
| 297 | 357 | let rectFrom = new rectData(); |
| 298 | 358 | let rectTo = new rectData(); |
| 299 | 359 | rectFrom.setLTWH(this.scaleStartLeft, this.scaleStartTop, this.scaleStartWidth, this.scaleStartHeight); |
| 300 | - rectTo.setLTWH(this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY); | |
| 360 | +// rectTo.setLTWH(this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY); | |
| 361 | + rectTo.setLTWH(this.scaleStartLeft + resultLT[0], this.scaleStartTop + resultLT[1], this.scaleStartWidth + resultRB[0], this.scaleStartHeight + resultRB[1]); | |
| 301 | 362 | |
| 302 | 363 | let scaleY = 1.0; |
| 303 | 364 | switch (1) { |
| @@ -320,6 +381,8 @@ | ||
| 320 | 381 | |
| 321 | 382 | onMouseDownRoll(evt) { |
| 322 | 383 | this.debuglog('onMouseDownRoll'); |
| 384 | + let eleFocus = this.getFocusdElements(); | |
| 385 | + if (eleFocus.length < 2) return; | |
| 323 | 386 | evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる) |
| 324 | 387 | evt.preventDefault(); // 要素既定のdefault動作を止める |
| 325 | 388 |
| @@ -373,8 +436,8 @@ | ||
| 373 | 436 | let x2 = evt.pageX; |
| 374 | 437 | let y2 = evt.pageY; |
| 375 | 438 | // 画像を反転している場合、マウス入力座標も反転させる |
| 376 | - let tmp1 = rotateUD(y1, eleFocus[0].this.degUD, evt.pageX, evt.pageY); | |
| 377 | - let tmp2 = rotateLR(x1, eleFocus[0].this.degLR, evt.pageX, evt.pageY); | |
| 439 | + let tmp1 = rotateUD(y1, this.degUD, evt.pageX, evt.pageY); | |
| 440 | + let tmp2 = rotateLR(x1, this.degLR, evt.pageX, evt.pageY); | |
| 378 | 441 | x2 = tmp2[0]; |
| 379 | 442 | y2 = tmp1[1]; |
| 380 | 443 | // ------------ |
| @@ -192,13 +192,9 @@ | ||
| 192 | 192 | this.y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2; |
| 193 | 193 | this.degUD = parseInt(eleFocus[0].dataset.mirrorud); |
| 194 | 194 | this.degLR = parseInt(eleFocus[0].dataset.mirrorlr); |
| 195 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 196 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 197 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 198 | - // x2 = tmp2[0]; | |
| 199 | - // y2 = tmp1[1]; | |
| 200 | - // x2 = tmp3[0]; | |
| 201 | - // y2 = tmp3[1]; | |
| 195 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 196 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 197 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 202 | 198 | // ------------ |
| 203 | 199 | |
| 204 | 200 | // 移動元として座標を保持 |
| @@ -220,11 +216,9 @@ | ||
| 220 | 216 | // let y1 = parseInt(eleFocus[0].style.top) + parseInt(eleFocus[0].style.height) / 2; |
| 221 | 217 | // let degUD = parseInt(eleFocus[0].dataset.mirrorud); |
| 222 | 218 | // let degLR = parseInt(eleFocus[0].dataset.mirrorlr); |
| 223 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 224 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 225 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 226 | - // x2 = tmp3[0]; | |
| 227 | - // y2 = tmp3[1]; | |
| 219 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 220 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 221 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 228 | 222 | // ------------ |
| 229 | 223 | |
| 230 | 224 |
| @@ -238,6 +232,53 @@ | ||
| 238 | 232 | let mirrorCodUD = (this.degUD) ? -1 : 0; |
| 239 | 233 | let mirrorCodLR = (this.degLR) ? -1 : 0; |
| 240 | 234 | |
| 235 | +/* | |
| 236 | + let resultLeft = this.scaleStartLeft; | |
| 237 | + let resultTop = this.scaleStartTop; | |
| 238 | + let resultRight = this.scaleStartLeft + (this.scaleStartWidth + moveX); | |
| 239 | + let resultBottom = this.scaleStartTop + (this.scaleStartHeight + moveY); | |
| 240 | + let resultLT = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, resultLeft, resultTop); | |
| 241 | + let resultRB = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, resultRight, resultBottom); | |
| 242 | +*/ | |
| 243 | + /* | |
| 244 | + width, heightを増減させたときの transform-origin相当の設定を変化させる必要がある | |
| 245 | + 座標指定は常に左上基準になっており、これを変更することができない | |
| 246 | + 回転させたときに左上位置が見た目上の座標系と物理的座標系でずれてしまうことで | |
| 247 | + 操作と表示にずれが発生している | |
| 248 | + | |
| 249 | + Math.cos(degToRad(degree)) | |
| 250 | +cos y座標の増分に対して | |
| 251 | +1 0度 : y + 0% height + 100% x + 0% width + 0% height | |
| 252 | +0 90度 : y + 0% height + 0% x + 0% width + 100% width | |
| 253 | +-1 180度 : y + -100% height + 0% x + 0% width + 0% y | |
| 254 | +0 270度 : y + 0% height + 0% x + -100% width + 0% x | |
| 255 | +1 360度 : y + 0% height + 100% x + 0% width + 0% height | |
| 256 | + y1 = y増分 * cos(theta) x1 = y増分 * sin(theta) | |
| 257 | + ~~~~~\ | |
| 258 | + yの変化量にsinを掛ける | |
| 259 | + | |
| 260 | +sin x座標の増分に対して | |
| 261 | +0 0度 : x + 0% width + 100% | |
| 262 | +1 90度 : | |
| 263 | +0 180度 : x + -100% width + 0% | |
| 264 | +-1 270度 : | |
| 265 | +0 360度 : | |
| 266 | + y2 = x増分 * cos(theta) x2 = x増分 * sin(theta) | |
| 267 | + | |
| 268 | + ((x1+x2),(y1+y2)) | |
| 269 | + | |
| 270 | + x1 y1 x2, y2 | |
| 271 | + ( 0, 0)-(増分x,増分y) に対してrotateZ(degree) すればいい? | |
| 272 | + 算出結果 x1',y1'-x2',y2'をleft,top,right,bottomに加算? | |
| 273 | + */ | |
| 274 | + let deg = parseFloat(eleFocus[0].dataset.degree) * -1; | |
| 275 | + let resultLT = rotateZ(0, 0, deg, 0, 0); | |
| 276 | + | |
| 277 | + let resultRB = rotateZ(0, 0, deg, moveX, moveY); | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 241 | 282 | switch (1) { |
| 242 | 283 | case 0: // 領域サイズ変更のみ |
| 243 | 284 | window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartWidth + moveX, this.scaleStartHeight + moveY)); |
| @@ -246,7 +287,8 @@ | ||
| 246 | 287 | { |
| 247 | 288 | let orgheight = parseInt(eleFocus[1].dataset.orgheight); |
| 248 | 289 | let scaleY = (this.scaleStartHeight + moveY) / orgheight * 100; // ★さらに初期倍率設定値を掛ける必要がある |
| 249 | - window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY, scaleY)); | |
| 290 | +// window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY, scaleY)); | |
| 291 | + window.renderLoop.requestRenderFunc(this.renderMouseMoveScale.bind(this, this.scaleStartLeft + resultLT[0], this.scaleStartTop + resultLT[1], this.scaleStartWidth + resultRB[0], this.scaleStartHeight + resultRB[1], scaleY)); | |
| 250 | 292 | } |
| 251 | 293 | break; |
| 252 | 294 | } |
| @@ -270,6 +312,18 @@ | ||
| 270 | 312 | break; |
| 271 | 313 | } |
| 272 | 314 | } |
| 315 | + renderMouseMoveScaleLTRB(left, top, right, bottom, scalefont) { | |
| 316 | + let eleFocus = this.getFocusdElements(); | |
| 317 | + if (eleFocus.length < 2) return; | |
| 318 | + eleFocus[1].style.opacity = 0.4; | |
| 319 | + | |
| 320 | + eleFocus[0].style.left = left + "px"; | |
| 321 | + eleFocus[0].style.top = top + "px"; | |
| 322 | + eleFocus[0].style.right = right + "px"; | |
| 323 | + eleFocus[0].style.bottom = bottom + "px"; | |
| 324 | + eleFocus[1].style.fontSize = scalefont + '%'; | |
| 325 | + } | |
| 326 | + | |
| 273 | 327 | mouseUpScale(evt) { |
| 274 | 328 | this.debuglog('mouseUpScale'); |
| 275 | 329 | // Mouse event callback設定をクリア |
| @@ -280,9 +334,9 @@ | ||
| 280 | 334 | evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる) |
| 281 | 335 | evt.preventDefault(); // 要素既定のdefault動作を止める |
| 282 | 336 | |
| 283 | - let tmp1 = rotateUD(this.y1, this.degUD, evt.pageX, evt.pageY); | |
| 284 | - let tmp2 = rotateLR(this.x1, this.degLR, evt.pageX, evt.pageY); | |
| 285 | - let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, tmp2[0], tmp1[1]); | |
| 337 | + let tmp3 = rotateZ(this.x1, this.y1, eleFocus[0].dataset.degree, evt.pageX, evt.pageY); | |
| 338 | + let tmp1 = rotateUD(this.y1, this.degUD, tmp3[0], tmp3[1]); | |
| 339 | + let tmp2 = rotateLR(this.x1, this.degLR, tmp3[0], tmp3[1]); | |
| 286 | 340 | |
| 287 | 341 | // 画像の仮変形 |
| 288 | 342 | this.endDragX = tmp2[0]; |
| @@ -294,10 +348,17 @@ | ||
| 294 | 348 | let mirrorCodUD = (this.degUD) ? -1 : 0; |
| 295 | 349 | let mirrorCodLR = (this.degLR) ? -1 : 0; |
| 296 | 350 | |
| 351 | + | |
| 352 | + let deg = parseFloat(eleFocus[0].dataset.degree) * -1; | |
| 353 | + let resultLT = rotateZ(0, 0, deg, 0, 0); | |
| 354 | + let resultRB = rotateZ(0, 0, deg, moveX, moveY); | |
| 355 | + | |
| 356 | + | |
| 297 | 357 | let rectFrom = new rectData(); |
| 298 | 358 | let rectTo = new rectData(); |
| 299 | 359 | rectFrom.setLTWH(this.scaleStartLeft, this.scaleStartTop, this.scaleStartWidth, this.scaleStartHeight); |
| 300 | - rectTo.setLTWH(this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY); | |
| 360 | +// rectTo.setLTWH(this.scaleStartLeft + (mirrorCodLR * moveX), this.scaleStartTop + (mirrorCodUD * moveY), this.scaleStartWidth + moveX, this.scaleStartHeight + moveY); | |
| 361 | + rectTo.setLTWH(this.scaleStartLeft + resultLT[0], this.scaleStartTop + resultLT[1], this.scaleStartWidth + resultRB[0], this.scaleStartHeight + resultRB[1]); | |
| 301 | 362 | |
| 302 | 363 | let scaleY = 1.0; |
| 303 | 364 | switch (1) { |
| @@ -320,6 +381,8 @@ | ||
| 320 | 381 | |
| 321 | 382 | onMouseDownRoll(evt) { |
| 322 | 383 | this.debuglog('onMouseDownRoll'); |
| 384 | + let eleFocus = this.getFocusdElements(); | |
| 385 | + if (eleFocus.length < 2) return; | |
| 323 | 386 | evt.stopPropagation(); // event伝播を自分のところで止める(上位に行かなくなる) |
| 324 | 387 | evt.preventDefault(); // 要素既定のdefault動作を止める |
| 325 | 388 |
| @@ -373,8 +436,8 @@ | ||
| 373 | 436 | let x2 = evt.pageX; |
| 374 | 437 | let y2 = evt.pageY; |
| 375 | 438 | // 画像を反転している場合、マウス入力座標も反転させる |
| 376 | - let tmp1 = rotateUD(y1, eleFocus[0].this.degUD, evt.pageX, evt.pageY); | |
| 377 | - let tmp2 = rotateLR(x1, eleFocus[0].this.degLR, evt.pageX, evt.pageY); | |
| 439 | + let tmp1 = rotateUD(y1, this.degUD, evt.pageX, evt.pageY); | |
| 440 | + let tmp2 = rotateLR(x1, this.degLR, evt.pageX, evt.pageY); | |
| 378 | 441 | x2 = tmp2[0]; |
| 379 | 442 | y2 = tmp1[1]; |
| 380 | 443 | // ------------ |
| @@ -1,17 +0,0 @@ | ||
| 1 | -dummy { | |
| 2 | - animation: ripple 0.6s linear infinite; | |
| 3 | -} | |
| 4 | -@keyframes ripple { | |
| 5 | - 0% { | |
| 6 | - box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1), | |
| 7 | - 0 0 0 20px rgba(255, 255, 255, 0.1), | |
| 8 | - 0 0 0 40px rgba(255, 255, 255, 0.1), | |
| 9 | - 0 0 0 60px rgba(255, 255, 255, 0.1); | |
| 10 | - } | |
| 11 | - 100% { | |
| 12 | - box-shadow: 0 0 0 20px rgba(255, 255, 255, 0.1), | |
| 13 | - 0 0 0 40px rgba(255, 255, 255, 0.1), | |
| 14 | - 0 0 0 60px rgba(255, 255, 255, 0.1), | |
| 15 | - 0 0 0 80px rgba(255, 255, 255, 0); | |
| 16 | - } | |
| 17 | -} |
| @@ -0,0 +1,17 @@ | ||
| 1 | +dummy { | |
| 2 | + animation: ripple 0.6s linear infinite; | |
| 3 | +} | |
| 4 | +@keyframes ripple { | |
| 5 | + 0% { | |
| 6 | + box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1), | |
| 7 | + 0 0 0 20px rgba(255, 255, 255, 0.1), | |
| 8 | + 0 0 0 40px rgba(255, 255, 255, 0.1), | |
| 9 | + 0 0 0 60px rgba(255, 255, 255, 0.1); | |
| 10 | + } | |
| 11 | + 100% { | |
| 12 | + box-shadow: 0 0 0 20px rgba(255, 255, 255, 0.1), | |
| 13 | + 0 0 0 40px rgba(255, 255, 255, 0.1), | |
| 14 | + 0 0 0 60px rgba(255, 255, 255, 0.1), | |
| 15 | + 0 0 0 80px rgba(255, 255, 255, 0); | |
| 16 | + } | |
| 17 | +} |
| @@ -0,0 +1,17 @@ | ||
| 1 | +dummy { | |
| 2 | + animation: ripple 0.6s linear infinite; | |
| 3 | +} | |
| 4 | +@keyframes ripple { | |
| 5 | + 0% { | |
| 6 | + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.1), | |
| 7 | + 0 0 0 20px rgba(255, 0, 0, 0.1), | |
| 8 | + 0 0 0 40px rgba(255, 0, 0, 0.1), | |
| 9 | + 0 0 0 60px rgba(255, 0, 0, 0.1); | |
| 10 | + } | |
| 11 | + 100% { | |
| 12 | + box-shadow: 0 0 0 20px rgba(255, 0, 0, 0.1), | |
| 13 | + 0 0 0 40px rgba(255, 0, 0, 0.1), | |
| 14 | + 0 0 0 60px rgba(255, 0, 0, 0.1), | |
| 15 | + 0 0 0 80px rgba(255, 0, 0, 0); | |
| 16 | + } | |
| 17 | +} |
| @@ -0,0 +1 @@ | ||
| 1 | + border-radius: 50% | |
| \ No newline at end of file |