some changes

This commit is contained in:
lunarcleint
2023-09-04 14:34:26 -07:00
parent 0d17236e3b
commit feb107981f
3 changed files with 10 additions and 7 deletions
+5 -3
View File
@@ -464,10 +464,11 @@ class Charter extends UIState {
refreshBPMSensitive();
}
public var __endStep:Float = 0;
public function refreshBPMSensitive() {
// refreshes everything dependant on BPM, and BPM changes
var length = FlxG.sound.music.getDefault(vocals).length;
scrollBar.length = Conductor.getStepForTime(length);
scrollBar.length = __endStep = Conductor.getStepForTime(length);
gridBackdropGroup.bottomLimitY = Conductor.getStepForTime(length) * 40;
eventsBackdrop.bottomSeparator.y = gridBackdropGroup.bottomLimitY-2;
@@ -558,6 +559,7 @@ class Charter extends UIState {
selection.loop(function (n:CharterNote) {
n.snappedToStrumline = false;
n.setPosition(n.fullID * 40 + (mousePos.x - dragStartPos.x), n.step * 40 + (mousePos.y - dragStartPos.y));
n.y = FlxMath.bound(n.y, 0, (__endStep*40) - n.height);
n.cursor = HAND;
}, function (e:CharterEvent) {
e.y = e.step * 40 + (mousePos.y - dragStartPos.y) - 17;
@@ -611,9 +613,9 @@ class Charter extends UIState {
for (n in selection) n.selected = false;
selection = []; // clear selection
} else {
if (mouseOnGrid) {
if (mouseOnGrid && mousePos.y > 0 && mousePos.y < (__endStep)*40) {
var note = new CharterNote();
note.updatePos(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Math.floor(mousePos.y / 40), id % 4, 0, 0, strumLines.members[Std.int(id/4)]);
note.updatePos(FlxMath.bound(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Math.floor(mousePos.y / 40), 0, __endStep-1), id % 4, 0, 0, strumLines.members[Std.int(id/4)]);
notesGroup.add(note);
selection = [note];
undos.addToUndo(CCreateSelection([note]));
+2 -1
View File
@@ -152,11 +152,12 @@ class CharterNote extends UISprite implements ICharterSelectable {
}
public function handleDrag(change:FlxPoint) {
var newStep = FlxMath.bound(step + change.x, 0, Charter.instance.__endStep-1);
var newID:Int = fullID + Std.int(change.y);
if (newID > ((Charter.instance.strumLines.members.length*4)-1)) newID %= 4;
else if (newID < 0) newID = (Charter.instance.strumLines.members.length*4) + newID % 4;
updatePos(step + change.x, newID % 4, susLength, type, Charter.instance.strumLines.members[Std.int(newID/4)]);
updatePos(newStep, newID % 4, susLength, type, Charter.instance.strumLines.members[Std.int(newID/4)]);
}
public override function draw() {
@@ -37,11 +37,11 @@ class CharterStrumLineGroup extends FlxTypedGroup<CharterStrumline> {
for (i=>strum in members)
if (strum != null && !strum.dragging) strum.x = CoolUtil.fpsLerp(strum.x, 160 * i, 0.225);
if (Charter.instance.eventsBackdrop != null)
if (Charter.instance.eventsBackdrop != null && members[0] != null)
Charter.instance.eventsBackdrop.x = members[0].button.x - Charter.instance.eventsBackdrop.width;
if (Charter.instance.strumlineLockButton != null)
if (Charter.instance.strumlineLockButton != null && members[0] != null)
Charter.instance.strumlineLockButton.x = members[0].x - (40*4);
if (Charter.instance.strumlineAddButton != null)
if (Charter.instance.strumlineAddButton != null && members[Std.int(Math.max(0, members.length-1))] != null)
Charter.instance.strumlineAddButton.x = members[members.length-1].x + (40*4);
if ((FlxG.mouse.justReleased || !draggable) && isDragging)