간단하게 드래그를 만들려고 & 드롭 운동을했지만 레티 나 iPad에서 "& 드래그 드래그"가 제대로 작동하지 않습니다.레티 나 iPad (createjs)에서 드래그 앤 드롭이 제대로 작동하지 않습니다
var that = this;
createjs.Touch.enable(stage);
stage.enableMouseOver(10);
function initPage() {
var shape = new createjs.Shape();
shape.graphics.beginFill("#999999").drawRoundRect(100,100,140,60,8).endFill();
shape.on("mousedown", function(evt) {
this.alpha = 0.8;
this.offset = {x: this.x - evt.stageX, y: this.y - evt.stageY};
});
shape.on("pressmove", function(evt) {
this.x = evt.stageX + this.offset.x;
this.y = evt.stageY + this.offset.y;
});
shape.on("pressup", function(evt) {
this.alpha = 1;
});
that.addChild(shape);
}
initPage();
나는 모양을 드래그 할 수 있지만, 더 내가 이동이 더 내 손가락에서 멀리 이동합니다 다음은 코드입니다. 여기에 그냥 녹화 된 영상이다 : 나는 어도비 애니메이션 CC 함께 일하고 있어요 https://dl.dropboxusercontent.com/u/11697167/animatecc-bug.mp4
, 내 보낸 HTML 파일은 망막 아이 패드와 같은 고해상도의 화면에서 잘 보이도록하기 위해 다음 코드가 포함
을//Code to support hidpi screens and responsive scaling.
function makeResponsive(isResp, respDim, isScale, scaleType) {
var lastW, lastH, lastS=1;
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
function resizeCanvas() {
var w = lib.properties.width, h = lib.properties.height;
var iw = window.innerWidth, ih=window.innerHeight;
var pRatio = window.devicePixelRatio || 1, xRatio=iw/w, yRatio=ih/h, sRatio=1;
if(isResp) {
if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) {
sRatio = lastS;
}
else if(!isScale) {
if(iw<w || ih<h)
sRatio = Math.min(xRatio, yRatio);
}
else if(scaleType==1) {
sRatio = Math.min(xRatio, yRatio);
}
else if(scaleType==2) {
sRatio = Math.max(xRatio, yRatio);
}
}
canvas.width = w*pRatio*sRatio;
canvas.height = h*pRatio*sRatio;
canvas.style.width = preloaderDiv.style.width = w*sRatio+'px';
canvas.style.height = preloaderDiv.style.height = h*sRatio+'px';
stage.scaleX = pRatio*sRatio;
stage.scaleY = pRatio*sRatio;
lastW = iw; lastH = ih; lastS = sRatio;
}
}
makeResponsive(false,'both',false,1);
resizeCanvas 기능을 제거한 경우 & 드롭을 iPad에서 잘 작동하지만 해상도가 훨씬 떨어집니다.
해결 방법에 대한 아이디어가 있으십니까?
감사합니다. 이제 모양을 움직이려 할 때 컴퓨터에서 "깜박 거리며"(갑자기 x/y 위치가 변경됨). 오프셋도 제거했지만 그 오프셋은 여전히 동일합니다. – kintaro
괜찮 았던 문제는 장치의 픽셀 비율이었습니다. iPad에서는 1 대신 2를 사용했습니다.이 문제가 해결되었습니다. this.x = evt.stageX/window.devicePixelRatio; this.y = evt.stageY/window.devicePixelRatio; – kintaro