-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial matrix #18
Comments
+1 on this, might be very useful :) |
I am searching since a week for a solution to set an initial matrix. Thump up to get this issue done. Has anyone a quick and dirty solution for this? |
I added a initMatrix method for this. I created a new class called: MyMatrixGestureDetector import 'dart:math'; import 'package:flutter/widgets.dart'; typedef MyMatrixGestureDetectorCallback = void Function( /// [MatrixGestureDetector] detects translation, scale and rotation gestures /// The [child] contained by this detector. /// Whether to detect translation gestures during the event processing. final Matrix4 initMatrix; /// Whether to detect scale gestures during the event processing. /// Whether to detect rotation gestures during the event processing. /// Whether [ClipRect] widget should clip [child] widget. /// When set, it will be used for computing a "fixed" focal point const MyMatrixGestureDetector({ @OverRide /// /// class _MyMatrixGestureDetectorState extends State { @OverRide @OverRide _ValueUpdater translationUpdater = _ValueUpdater( void onScaleStart(ScaleStartDetails details) { void onScaleUpdate(ScaleUpdateDetails details) {
} Matrix4 _translate(Offset translation) {
} Matrix4 _scale(double scale, Offset focalPoint) {
} Matrix4 _rotate(double angle, Offset focalPoint) {
} typedef _OnUpdate = T Function(T oldValue, T newValue); class _ValueUpdater { _ValueUpdater({this.onUpdate}); T update(T newValue) { class MyMatrixDecomposedValues { /// Scaling factor. /// Rotation in radians, (-pi..pi) range. MyMatrixDecomposedValues(this.translation, this.scale, this.rotation); @OverRide In your build method: return MyMatrixGestureDetector( |
It is pretty common to be able to edit an already transformed image.
For this use case, it would be needed to initialize the widget with an initial transform.
The text was updated successfully, but these errors were encountered: