DRAGGING WORKS :DD
This commit is contained in:
@@ -1397,11 +1397,10 @@ class Charter extends UIState {
|
||||
if (note.step > Conductor.curMeasure*Conductor.getMeasureLength() && note.step < (Conductor.curMeasure+1)*Conductor.getMeasureLength()) note
|
||||
];
|
||||
}
|
||||
|
||||
#end
|
||||
|
||||
function changeNoteSustain(change:Float) {
|
||||
if (selection.length <= 0 || change == 0) return;
|
||||
if (selection.length <= 0 || change == 0 || gridActionType != NONE) return;
|
||||
|
||||
var undoChanges:Array<NoteSustainChange> = [];
|
||||
for(s in selection)
|
||||
|
||||
@@ -78,6 +78,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
|
||||
|
||||
typeText.exists = type != 0;
|
||||
typeText.text = Std.string(this.type);
|
||||
typeText.follow(this, 20 - (typeText.frameWidth/2), 20 - (typeText.frameHeight/2));
|
||||
|
||||
y = step * 40;
|
||||
|
||||
@@ -85,6 +86,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
|
||||
sustainSpr.updateHitbox();
|
||||
sustainSpr.exists = susLength != 0;
|
||||
sustainSpr.alpha = alpha;
|
||||
sustainSpr.follow(this, 15, 20);
|
||||
|
||||
if (angleTween != null) angleTween.cancel();
|
||||
|
||||
|
||||
@@ -12,47 +12,70 @@ class CharterNoteHoverer extends CharterNote {
|
||||
public override function update(elapsed:Float) @:privateAccess {
|
||||
FlxG.mouse.getWorldPosition(FlxG.camera, __mousePos);
|
||||
|
||||
var inBoundsY:Bool = (__mousePos.y > 0 && __mousePos.y < (Charter.instance.__endStep)*40);
|
||||
if (__mousePos.x > 0 && __mousePos.x < Charter.instance.gridBackdrops.strumlinesAmount * 160 && inBoundsY) {
|
||||
step = FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((__mousePos.y-20) / 40) : Charter.instance.quantStep(__mousePos.y/40), 0, Charter.instance.__endStep-1);
|
||||
id = Math.floor(__mousePos.x / 40); y = step * 40; x = id * 40; visible = true;
|
||||
angle = switch(animation.curAnim.curFrame = (id % 4)) {
|
||||
case 0: -90;
|
||||
case 1: 180;
|
||||
case 2: 0;
|
||||
case 3: 90;
|
||||
default: 0; // how is that even possible
|
||||
};
|
||||
} else
|
||||
visible = false;
|
||||
}
|
||||
|
||||
public override function draw() @:privateAccess {
|
||||
if (Charter.instance.gridActionType == NONE) super.draw();
|
||||
if (Charter.instance.gridActionType == DRAG) {
|
||||
visible = true; __doAnim = false;
|
||||
|
||||
var verticalChange:Float = (__mousePos.y - Charter.instance.dragStartPos.y) / 40;
|
||||
var horizontalChange:Int = CoolUtil.floorInt((__mousePos.x - (Std.int(Charter.instance.dragStartPos.x / 40) * 40)) / 40);
|
||||
|
||||
for (s in Charter.selection) {
|
||||
if (s != null && s.draggable && s is CharterNote) {
|
||||
var draggingNote:CharterNote = cast(s, CharterNote);
|
||||
y = ((draggingNote.step + verticalChange) - ((draggingNote.step + verticalChange)
|
||||
- Charter.instance.quantStepRounded(draggingNote.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65))) * 40;
|
||||
var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1));
|
||||
x = (id=newID) * 40;
|
||||
|
||||
angle = switch(animation.curAnim.curFrame = (draggingNote.id % 4)) {
|
||||
switch (Charter.instance.gridActionType) {
|
||||
case NONE:
|
||||
var inBoundsY:Bool = (__mousePos.y > 0 && __mousePos.y < (Charter.instance.__endStep)*40);
|
||||
if (__mousePos.x > 0 && __mousePos.x < Charter.instance.gridBackdrops.strumlinesAmount * 160 && inBoundsY) {
|
||||
step = FlxMath.bound(FlxG.keys.pressed.SHIFT ? ((__mousePos.y-20) / 40) : Charter.instance.quantStep(__mousePos.y/40), 0, Charter.instance.__endStep-1);
|
||||
id = Math.floor(__mousePos.x / 40); y = step * 40; x = id * 40; visible = true; sustainSpr.visible = typeText.visible = false;
|
||||
angle = switch(animation.curAnim.curFrame = (id % 4)) {
|
||||
case 0: -90;
|
||||
case 1: 180;
|
||||
case 2: 0;
|
||||
case 3: 90;
|
||||
default: 0; // how is that even possible
|
||||
};
|
||||
super.draw();
|
||||
} else
|
||||
visible = false;
|
||||
case DRAG:
|
||||
visible = sustainSpr.visible = typeText.visible = true; __doAnim = false;
|
||||
default:
|
||||
visible = sustainSpr.visible = typeText.visible = false; __doAnim = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override function draw() @:privateAccess {
|
||||
switch (Charter.instance.gridActionType) {
|
||||
case NONE:
|
||||
super.draw();
|
||||
case DRAG:
|
||||
if (Charter.instance.gridActionType == DRAG) {
|
||||
var verticalChange:Float = (__mousePos.y - Charter.instance.dragStartPos.y) / 40;
|
||||
var horizontalChange:Int = CoolUtil.floorInt((__mousePos.x - (Std.int(Charter.instance.dragStartPos.x / 40) * 40)) / 40);
|
||||
|
||||
for (s in Charter.selection) {
|
||||
if (s != null && s.draggable && s is CharterNote) {
|
||||
var draggingNote:CharterNote = cast(s, CharterNote);
|
||||
y = (draggingNote.step + verticalChange);
|
||||
if (!FlxG.keys.pressed.SHIFT)
|
||||
y -= ((draggingNote.step + verticalChange)
|
||||
- Charter.instance.quantStepRounded(draggingNote.step+verticalChange, verticalChange > 0 ? 0.35 : 0.65));
|
||||
y *= 40;
|
||||
var newID:Int = Std.int(FlxMath.bound(draggingNote.fullID + horizontalChange, 0, (Charter.instance.strumLines.members.length*4)-1));
|
||||
x = (id=newID) * 40; y = FlxMath.bound(y, 0, (Charter.instance.__endStep*40) - height);
|
||||
|
||||
angle = switch(animation.curAnim.curFrame = (draggingNote.id % 4)) {
|
||||
case 0: -90;
|
||||
case 1: 180;
|
||||
case 2: 0;
|
||||
case 3: 90;
|
||||
default: 0; // how is that even possible
|
||||
};
|
||||
|
||||
sustainSpr.scale.set(10, (40 * draggingNote.susLength) + (height/2));
|
||||
sustainSpr.color = CharterNote.colors[animation.curAnim.curFrame];
|
||||
sustainSpr.updateHitbox(); sustainSpr.alpha = alpha; sustainSpr.follow(this, 15, 20);
|
||||
sustainSpr.exists = draggingNote.susLength != 0;
|
||||
|
||||
typeText.text = Std.string(draggingNote.type);
|
||||
typeText.exists = draggingNote.type != 0;
|
||||
typeText.follow(this, 20 - (typeText.frameWidth/2), 20 - (typeText.frameHeight/2));
|
||||
|
||||
super.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
default: // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user