无法停止mousemove事件

时间:2016-12-16 21:28:05

标签: javascript

我已经有了用纯javascript和sass编写游戏代码的想法。 但是当我开始旋转容器立方体时,我无法阻止它。 我尝试了preventDefault,stopPropagation函数,并尝试将运行事件分配给null但没有任何反应。

@When("^I call CPAuth service for ChasePay$")
public void i_call_CPAuth_service_for_ChasePay() throws Throwable {
    designer.send("CitrusContext")
    .messageType(MessageType.JSON)
    .header(X_JPMC_CSRF_TOKEN_HEADER, csrfToken)
    .header(HTTP.CONTENT_TYPE, APPLICATION_JSON)
    .header(COOKIE, ConnRoutePNames.DEFAULT_PROXY + "=" + proxy)
    .header("citrus_endpoint_uri", authUrl +"/auth/fcc/login")
    .message(new HttpMessage("<large_string=no_issues_here>").method(HttpMethod.POST));

    designer.receive("CitrusContext").messageType(MessageType.JSON)
    .validate("$.response", "secauth")
    .validate("$.newstoken", false)
    .validate("$.smtoken", "void")
    .extractFromPayload("$.spid", "myVar");

    String request = URLEncoder.encode("appStoreBundleId=com.testmerchant.sampleapp&version=APP%2BBUILD%2BVERSION&channelId=MPD&spid=**${myVar}**&type=json&chasePayMerchantId=1390xxx", CharEncoding.UTF_8);
    System.out.println("request: "+request);
    designer.send("CitrusContext")
    .messageType(MessageType.JSON)
    .header(X_JPMC_CSRF_TOKEN_HEADER, csrfToken)
    .header(HTTP.CONTENT_TYPE, APPLICATION_JSON)
    .header(COOKIE, ConnRoutePNames.DEFAULT_PROXY + "=" + proxy)
    .header("citrus_endpoint_uri", hostUrl +"/pwc/provisioning/pos/otp/contact/v20160313/list.action")
    .message(new HttpMessage(request).method(HttpMethod.POST));

我尝试过的解决方案:

    document.body.onmousedown = function (e) {
        'use strict';
        var x = e.clientX,
            y = e.clientY;
        document.body.onmousemove = function (e) {
            var X = e.clientX - x,
                Y = e.clientY - y;
            console.log('rotateX(' + Math.floor(Y) + 'deg) rotateY(' + Math.floor(X) + 'deg)');
            document.querySelector('main').style.cssText = 'transform:rotateX(' + parseInt(Math.floor(Y)) + 'deg) rotateY(' + parseInt(Math.floor(X)) + 'deg)';

        };
    };

0 个答案:

没有答案