-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Feature/#66 pan while zoom #68
Merged
Merged
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
598e072
apply pan based on the focus point change
markusressel 6f069b0
fix overscroll animation on pinch end
markusressel 53219ec
documentation fixes
markusressel ead2c4d
allow overpinch and overscroll simultaniously in applyZoomAndAbsolute…
markusressel ef2697f
removed unnecessary float/int conversion
markusressel 35a21df
changed pivot point of applyZoomAndAbsolutePan
markusressel c45edca
use coerceIn
markusressel 28d74b2
added documentation
markusressel 322cdd8
use zoom simulation to calculate correct panFix values
markusressel 321bf7e
added commentary to describe what is happening
markusressel 42bac02
revert default animation duration
markusressel 87d2617
refactored fields to use PointF instead of raw Float values
markusressel d200629
added AbsolutePoint and ScaledPoint data classes for easier handling …
markusressel a2c15cc
added methods to ScaledPoint too
markusressel 3f45011
keep the original zoomTarget even when an additional view boundary wi…
markusressel ca9a807
changed comment to be more precise
markusressel fc16259
var can be val
markusressel e8a0990
Merge remote-tracking branch 'origin/master' into feature/#66_pan_whi…
markusressel 501648f
added default values to AbsolutePoint and ScaledPoint constructor
markusressel 60fa369
replaced individual variables for x and y values with AbsolutePoint
markusressel e0c006d
added "*" operator to AbsolutePoint and ScaledPoint
markusressel d9321d4
make more use of ScaledPoint instead of two variables
markusressel 249e511
added target annotation to RealZoom, Zoom, AbsolutePan, ScaledPan and…
markusressel aafbee5
define archive basename (because "app" is kind of useless)
markusressel 07f1163
use the center of the mContentRect as a pivot point when scaling back…
markusressel 6163469
also reset pan after simulation
markusressel ac48d18
added method to simplify "pan fix" calculation
markusressel c92e782
renamed resetState() method in PinchListener and added documentation
markusressel 3bc22ee
sind androidx support lib version numbers are not in perfect sync any…
markusressel bd489aa
added methods for minZoom and maxZoom
markusressel 22ad009
cancel any currently running animation when touching the screen - fix…
markusressel bf250ae
use PropertyValuesHolder to animate multiple animators concurrently
markusressel bbe7197
ignore lint issue
markusressel 0d2a454
doku fix
markusressel 3d9dba7
added copy constructor to Points
markusressel 95f78a3
review fixes
markusressel 253260b
add pan to ZoomApi
markusressel 7246dda
review fix
markusressel 15ad66b
Merge remote-tracking branch 'origin/master' into feature/#66_pan_whi…
markusressel b3d2beb
merge and compile fix
markusressel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
library/src/main/java/com/otaliastudios/zoom/AbsolutePoint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.otaliastudios.zoom | ||
|
||
/** | ||
* This class represents an absolute point on the ZoomEngine canvas (or beyond it's bounds) | ||
*/ | ||
data class AbsolutePoint( | ||
markusressel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@ZoomApi.AbsolutePan var x: Float = 0F, | ||
@ZoomApi.AbsolutePan var y: Float = 0F) { | ||
|
||
/** | ||
* Copy constructor | ||
* | ||
* @param point point to duplicate | ||
*/ | ||
constructor(point: AbsolutePoint) : this(point.x, point.y) | ||
|
||
/** | ||
* Set new coordinates | ||
* | ||
* @param x x-axis value | ||
* @param y y-axis value | ||
*/ | ||
@JvmOverloads | ||
fun set(@ZoomApi.AbsolutePan x: Number = this.x, @ZoomApi.AbsolutePan y: Number = this.y) { | ||
this.x = x.toFloat() | ||
this.y = y.toFloat() | ||
} | ||
|
||
/** | ||
* Set new coordinates | ||
* | ||
* @param p the [AbsolutePoint] to copy values from | ||
*/ | ||
fun set(p: AbsolutePoint) { | ||
set(p.x, p.y) | ||
} | ||
|
||
/** | ||
* Substract a point from another point | ||
* | ||
* @param absolutePoint the point to substract | ||
*/ | ||
operator fun minus(absolutePoint: AbsolutePoint): AbsolutePoint { | ||
return AbsolutePoint(this.x - absolutePoint.x, this.y - absolutePoint.y) | ||
} | ||
|
||
/** | ||
* Negate a point | ||
* | ||
* @return the negative value of this point | ||
*/ | ||
operator fun unaryMinus(): AbsolutePoint { | ||
return AbsolutePoint(-this.x, -this.y) | ||
} | ||
|
||
/** | ||
* Add a point to another point | ||
* | ||
* @param absolutePoint the point to add | ||
*/ | ||
operator fun plus(absolutePoint: AbsolutePoint): AbsolutePoint { | ||
return AbsolutePoint(this.x + absolutePoint.x, this.y + absolutePoint.y) | ||
} | ||
|
||
/** | ||
* Multiply every value in the point by a given factor | ||
* | ||
* @param factor the factor to use | ||
* @return the multiplied point | ||
*/ | ||
operator fun times(factor: Number): AbsolutePoint { | ||
return AbsolutePoint(factor.toFloat() * this.x, factor.toFloat() * this.y) | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
library/src/main/java/com/otaliastudios/zoom/ScaledPoint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.otaliastudios.zoom | ||
|
||
/** | ||
* This class represents a scaled point on the ZoomEngine canvas (or beyond it's bounds) | ||
* | ||
* Note that these values depend on the current zoomlevel | ||
*/ | ||
data class ScaledPoint( | ||
@ZoomApi.ScaledPan var x: Float = 0F, | ||
@ZoomApi.ScaledPan var y: Float = 0F) { | ||
|
||
/** | ||
* Copy constructor | ||
* | ||
* @param point point to duplicate | ||
*/ | ||
constructor(point: ScaledPoint) : this(point.x, point.y) | ||
|
||
/** | ||
* Set new coordinates | ||
* | ||
* @param x x-axis value | ||
* @param y y-axis value | ||
*/ | ||
@JvmOverloads | ||
fun set(@ZoomApi.ScaledPan x: Number = this.x, @ZoomApi.ScaledPan y: Number = this.y) { | ||
this.x = x.toFloat() | ||
this.y = y.toFloat() | ||
} | ||
|
||
/** | ||
* Set new coordinates | ||
* | ||
* @param p the [ScaledPoint] to copy values from | ||
*/ | ||
fun set(p: ScaledPoint) { | ||
set(p.x, p.y) | ||
} | ||
|
||
/** | ||
* Substract a point from another point | ||
* | ||
* @param scaledPoint the point to substract | ||
*/ | ||
operator fun minus(scaledPoint: ScaledPoint): ScaledPoint { | ||
return ScaledPoint(this.x - scaledPoint.x, this.y - scaledPoint.y) | ||
} | ||
|
||
/** | ||
* Negate a point | ||
* | ||
* @return the negative value of this point | ||
*/ | ||
operator fun unaryMinus(): ScaledPoint { | ||
return ScaledPoint(-this.x, -this.y) | ||
} | ||
|
||
/** | ||
* Add a point to another point | ||
* | ||
* @param scaledPoint the point to add | ||
*/ | ||
operator fun plus(scaledPoint: ScaledPoint): ScaledPoint { | ||
return ScaledPoint(this.x + scaledPoint.x, this.y + scaledPoint.y) | ||
} | ||
|
||
/** | ||
* Multiply every value in the point by a given factor | ||
* | ||
* @param factor the factor to use | ||
* @return the multiplied point | ||
*/ | ||
operator fun times(factor: Number): ScaledPoint { | ||
return ScaledPoint(factor.toFloat() * this.x, factor.toFloat() * this.y) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building an apk (release or debug) the resulting apk file will be called this way.
I have too much
app-debug.apk
files in my life already 😛