Skip to content

Commit

Permalink
Fix resolution multiplying itself
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 13, 2024
1 parent 90110c2 commit d9f6b77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
18 changes: 10 additions & 8 deletions app/lib/cubits/current_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,16 +517,19 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
size = Size(bottomRight.dx - topLeft.dx, bottomRight.dy - topLeft.dy) *
transform.size;
}
rect = resolution.getRect(rect);
final renderTransform = transform.improve(resolution, size);
final document = blocState.data;
final page = blocState.page;
final info = blocState.info;
if (viewportSize != null) {
size *= resolution.multiplier;
}
final renderTransform = transform.improve(resolution, size / resolution.multiplier);
final viewChanged = cameraViewport.width != size.width.ceil() ||
cameraViewport.height != size.height.ceil() ||
cameraViewport.x != transform.position.dx ||
cameraViewport.y != transform.position.dy ||
cameraViewport.x != renderTransform.position.dx ||
cameraViewport.y != renderTransform.position.dy ||
cameraViewport.scale != transform.size;
rect = resolution.getRect(rect);
reset = reset || viewChanged;
resetAllLayers = resetAllLayers || viewChanged;
if (renderers.isEmpty && !reset) return;
Expand All @@ -542,8 +545,7 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
..addAll(renderers);
}
canvas.scale(ratio);
size *= resolution.multiplier;


// Wait one frame
await Future.delayed(const Duration(milliseconds: 1));

Expand Down Expand Up @@ -652,8 +654,8 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
width: size.width.ceil(),
pixelRatio: ratio,
scale: transform.size,
x: rect.left,
y: rect.top,
x: renderTransform.position.dx,
y: renderTransform.position.dy,
image: newImage,
bakedElements: renderers,
unbakedElements: currentRenderers,
Expand Down
4 changes: 2 additions & 2 deletions app/lib/dialogs/texture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _TextureViewState extends State<TextureView> {
fractionDigits: 0,
defaultValue: 0,
min: 0,
max: 500),
max: 20),
const SizedBox(height: 16),
ExactSlider(
onChanged: (value) => widget
Expand Down Expand Up @@ -124,7 +124,7 @@ class _TextureViewState extends State<TextureView> {
defaultValue: 0,
fractionDigits: 0,
min: 0,
max: 500),
max: 20),
const SizedBox(height: 16),
ExactSlider(
onChanged: (value) => widget
Expand Down
1 change: 1 addition & 0 deletions metadata/en-US/changelogs/124.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Improve responsiveness of exact slider
* Change zoom dependent to false by default
* Use material blue and red as default colors
* Improve sliders for background dialog
* Fix export on web
* Fix shape detection always enabled in pen tool
* Fix ruler not working correctly in pen tool
Expand Down

0 comments on commit d9f6b77

Please sign in to comment.