방금 Kinetic JS를 사용하기 시작했습니다. 이 링크를 보면Kinetic JS - 이미지의 크기를 조정할 때의 문제점
는 : Example
코드의 일부는 여기에 있습니다 : 코드의
function update(group, activeHandle) {
var topLeft = group.get(".topLeft")[0],
topRight = group.get(".topRight")[0],
bottomRight = group.get(".bottomRight")[0],
bottomLeft = group.get(".bottomLeft")[0],
image = group.get(".image")[0],
activeHandleName = activeHandle.getName(),
newWidth,
newHeight,
imageX,
imageY;
// Update the positions of handles during drag.
// This needs to happen so the dimension calculation can use the
// handle positions to determine the new width/height.
switch (activeHandleName) {
case "topLeft":
topRight.setY(activeHandle.getY());
bottomLeft.setX(activeHandle.getX());
break;
case "topRight":
topLeft.setY(activeHandle.getY());
bottomRight.setX(activeHandle.getX());
break;
case "bottomRight":
bottomLeft.setY(activeHandle.getY());
topRight.setX(activeHandle.getX());
break;
case "bottomLeft":
bottomRight.setY(activeHandle.getY());
topLeft.setX(activeHandle.getX());
break;
}
나머지는 jsdFiddle 링크입니다. 나는 무언가를 분명히 놓친 것 같습니다!
앵커로 둘러싸인 2 개의 이미지가 보입니다. 크기가 조정되거나 드래그 될 때 이미지가 검은 색 사각형 (예 : 경계)을 지나서는 안됩니다. 이미지가 이전에 크기가 조정되지 않은 경우 드래그가 작동합니다.
크기가 조정 된 이미지는 여전히 경계를 통과합니다. 크기가 조정 된 이미지를 드래그 앤 드롭하면 때로는 보이지 않는 경계가 생기기 쉽습니다 (이미지의 크기를 조절하는 사람이 오른쪽 하단 앵커를 사용하여 크기를 조정하지 않는 경우).
아무도 내가 잘못 한 것을 볼 수 있습니까?
많은 도움을 주셔서 감사합니다.
자세한 설명을 주셔서 대단히 감사합니다! 정말 감사합니다. – jagku