Skip to content

Commit

Permalink
Fix transformation pushed to reference handle, closes #615
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Mar 4, 2024
1 parent fb784b2 commit 2026c9c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/lib/dialogs/elements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ContextMenuBuilder buildElementsContextMenu(
}
cubit
.fetchHandler<SelectHandler>()
?.transform(bloc, null, transforms, true);
?.transform(bloc, null, next: transforms, duplicate: true);
},
label: AppLocalizations.of(context).duplicate,
),
Expand Down
9 changes: 6 additions & 3 deletions app/lib/handlers/select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ class SelectHandler extends Handler<SelectTool> {
SelectHandler(super.data);

void transform(DocumentBloc bloc, SelectionTransformCorner? corner,
[List<Renderer<PadElement>>? next, bool duplicate = false]) {
{List<Renderer<PadElement>>? next,
bool duplicate = false,
Offset? position}) {
_selected = next ?? _selected;
_submitTransform(bloc);
_updateSelectionRect();
_selectionManager.startTransformWithCorner(corner);
_selectionManager.startTransformWithCorner(corner, position);
_duplicate = duplicate;
bloc.refresh();
}
Expand Down Expand Up @@ -282,7 +284,8 @@ class SelectHandler extends Handler<SelectTool> {
_selectionManager.shouldTransform(globalPos, cameraTransform.size);
if (shouldTransform) {
transform(context.getDocumentBloc(),
_selectionManager.getCornerHit(globalPos, cameraTransform.size));
_selectionManager.getCornerHit(globalPos, cameraTransform.size),
position: globalPos);
return true;
}
context.refresh();
Expand Down
5 changes: 3 additions & 2 deletions app/lib/renderers/foregrounds/select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ class RectSelectionForegroundManager {
return true;
}

void startTransformWithCorner(SelectionTransformCorner? corner) {
void startTransformWithCorner(SelectionTransformCorner? corner,
[Offset? position]) {
_corner = corner;
_startPosition = corner.getFromRect(_selection);
_startPosition = position ?? corner.getFromRect(_selection);
_currentPosition = _startPosition;
}

Expand Down
1 change: 0 additions & 1 deletion app/lib/views/navigator/waypoints.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:butterfly/bloc/document_bloc.dart';
import 'package:butterfly_api/butterfly_api.dart';
import 'package:butterfly_api/butterfly_protocol.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/95.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
* Background
* Add ability to reorder waypoints
* Change waypoint identifier to the name instead of index
* Fix transformation pushed to reference handle ([#615](https://github.com/LinwoodDev/Butterfly/issues/615))

Read more here: https://linwood.dev/butterfly/2.1.0-beta.1

0 comments on commit 2026c9c

Please sign in to comment.