fix dragging "bug"
This commit is contained in:
@@ -359,27 +359,6 @@ class CharacterEditor extends UIState {
|
||||
}
|
||||
|
||||
inline function handleMouseOffsets() {
|
||||
var point = FlxG.mouse.getWorldPosition(charCamera, _point);
|
||||
if(character.animateAtlas == null) {
|
||||
StageEditor.calcSpriteBounds(character);
|
||||
var bounds:FlxRect = cast character.extra.get(StageEditor.exID("bounds"));
|
||||
|
||||
// my poor attempt at fixing the global offset flip hitbox bug
|
||||
/*
|
||||
if (character.isPlayer != character.playerOffsets) {
|
||||
bounds.x = character.globalOffset.x + character.animOffsets[character.getAnimName()].x;
|
||||
if (stage != null && stage.characterPoses.exists(stagePosition))
|
||||
bounds.x += stage.characterPoses.get(stagePosition).x;
|
||||
}
|
||||
*/
|
||||
|
||||
if (bounds.containsPoint(point)) {
|
||||
cameraHoverDummy.cursor = #if (mac) DRAG_OPEN; #elseif (linux) CLICK; #else MOVE; #end
|
||||
if (FlxG.mouse.justPressed)
|
||||
draggingCharacter = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (draggingCharacter) {
|
||||
cameraHoverDummy.cursor = #if (mac) DRAG; #elseif (linux) DRAG; #else MOVE; #end
|
||||
|
||||
@@ -395,6 +374,27 @@ class CharacterEditor extends UIState {
|
||||
draggingOffset.x += FlxG.mouse.deltaScreenX; draggingOffset.y += FlxG.mouse.deltaScreenY;
|
||||
character.extraOffset = draggingOffset;
|
||||
}
|
||||
} else {
|
||||
var point = FlxG.mouse.getWorldPosition(charCamera, _point);
|
||||
if(character.animateAtlas == null) {
|
||||
StageEditor.calcSpriteBounds(character);
|
||||
var bounds:FlxRect = cast character.extra.get(StageEditor.exID("bounds"));
|
||||
|
||||
// my poor attempt at fixing the global offset flip hitbox bug
|
||||
/*
|
||||
if (character.isPlayer != character.playerOffsets) {
|
||||
bounds.x = character.globalOffset.x + character.animOffsets[character.getAnimName()].x;
|
||||
if (stage != null && stage.characterPoses.exists(stagePosition))
|
||||
bounds.x += stage.characterPoses.get(stagePosition).x;
|
||||
}
|
||||
*/
|
||||
|
||||
if (bounds.containsPoint(point)) {
|
||||
cameraHoverDummy.cursor = #if (mac) DRAG_OPEN; #elseif (linux) CLICK; #else MOVE; #end
|
||||
if (FlxG.mouse.justPressed)
|
||||
draggingCharacter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ class CharacterGhost extends Character {
|
||||
|
||||
setAnimOffset(animation.name);
|
||||
alpha = 1; color = 0xFFFFFFFF;
|
||||
ghostDraw = false; super.draw();
|
||||
ghostDraw = false;
|
||||
|
||||
super.draw();
|
||||
}
|
||||
|
||||
public function setAnimOffset(anim:String) {
|
||||
|
||||
@@ -219,8 +219,8 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
}
|
||||
|
||||
if (!ghostDraw) {
|
||||
x += extraOffset.x;
|
||||
y += extraOffset.y;
|
||||
x -= extraOffset.x;
|
||||
y -= extraOffset.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user