Skip to content
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 40 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 17 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 Dec 27, 2018
6f069b0
fix overscroll animation on pinch end
markusressel Dec 27, 2018
53219ec
documentation fixes
markusressel Dec 27, 2018
ead2c4d
allow overpinch and overscroll simultaniously in applyZoomAndAbsolute…
markusressel Dec 27, 2018
ef2697f
removed unnecessary float/int conversion
markusressel Dec 27, 2018
35a21df
changed pivot point of applyZoomAndAbsolutePan
markusressel Dec 27, 2018
c45edca
use coerceIn
markusressel Dec 28, 2018
28d74b2
added documentation
markusressel Dec 28, 2018
322cdd8
use zoom simulation to calculate correct panFix values
markusressel Dec 28, 2018
321bf7e
added commentary to describe what is happening
markusressel Dec 28, 2018
42bac02
revert default animation duration
markusressel Dec 28, 2018
87d2617
refactored fields to use PointF instead of raw Float values
markusressel Dec 29, 2018
d200629
added AbsolutePoint and ScaledPoint data classes for easier handling …
markusressel Dec 29, 2018
a2c15cc
added methods to ScaledPoint too
markusressel Dec 29, 2018
3f45011
keep the original zoomTarget even when an additional view boundary wi…
markusressel Dec 29, 2018
ca9a807
changed comment to be more precise
markusressel Dec 29, 2018
fc16259
var can be val
markusressel Dec 29, 2018
e8a0990
Merge remote-tracking branch 'origin/master' into feature/#66_pan_whi…
markusressel Jan 3, 2019
501648f
added default values to AbsolutePoint and ScaledPoint constructor
markusressel Jan 3, 2019
60fa369
replaced individual variables for x and y values with AbsolutePoint
markusressel Jan 3, 2019
e0c006d
added "*" operator to AbsolutePoint and ScaledPoint
markusressel Jan 3, 2019
d9321d4
make more use of ScaledPoint instead of two variables
markusressel Jan 3, 2019
249e511
added target annotation to RealZoom, Zoom, AbsolutePan, ScaledPan and…
markusressel Jan 3, 2019
aafbee5
define archive basename (because "app" is kind of useless)
markusressel Jan 3, 2019
07f1163
use the center of the mContentRect as a pivot point when scaling back…
markusressel Jan 3, 2019
6163469
also reset pan after simulation
markusressel Jan 4, 2019
ac48d18
added method to simplify "pan fix" calculation
markusressel Jan 4, 2019
c92e782
renamed resetState() method in PinchListener and added documentation
markusressel Jan 4, 2019
3bc22ee
sind androidx support lib version numbers are not in perfect sync any…
markusressel Jan 4, 2019
bd489aa
added methods for minZoom and maxZoom
markusressel Jan 4, 2019
22ad009
cancel any currently running animation when touching the screen - fix…
markusressel Jan 4, 2019
bf250ae
use PropertyValuesHolder to animate multiple animators concurrently
markusressel Jan 4, 2019
bbe7197
ignore lint issue
markusressel Jan 4, 2019
0d2a454
doku fix
markusressel Jan 4, 2019
3d9dba7
added copy constructor to Points
markusressel Jan 5, 2019
95f78a3
review fixes
markusressel Jan 5, 2019
253260b
add pan to ZoomApi
markusressel Jan 5, 2019
7246dda
review fix
markusressel Jan 5, 2019
15ad66b
Merge remote-tracking branch 'origin/master' into feature/#66_pan_whi…
markusressel Jan 8, 2019
b3d2beb
merge and compile fix
markusressel Jan 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ android {
dependencies {
api "androidx.annotation:annotation:$supportLibVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.1"
}


Expand Down
49 changes: 49 additions & 0 deletions library/src/main/java/com/otaliastudios/zoom/AbsolutePoint.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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,
@ZoomApi.AbsolutePan var y: Float) {

/**
* Set new coordinates
*
* @param x x-axis value
* @param y y-axis value
*/
@JvmOverloads
fun set(@ZoomApi.AbsolutePan x: Float = this.x, @ZoomApi.AbsolutePan y: Float = this.y) {
this.x = x
this.y = y
}

/**
* 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)
}

/**
* 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)
}

}
62 changes: 62 additions & 0 deletions library/src/main/java/com/otaliastudios/zoom/ScaledPoint.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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,
@ZoomApi.ScaledPan var y: Float) {

/**
* Add the given values to this point
*
* @param x x-axis offset
* @param y y-axis offset
*/
fun offset(@ZoomApi.ScaledPan offsetX: Float = 0F, @ZoomApi.ScaledPan offsetY: Float = 0F) {
this.x += offsetX
this.y += offsetY
}

/**
* Set new coordinates
*
* @param x x-axis value
* @param y y-axis value
*/
@JvmOverloads
fun set(@ZoomApi.ScaledPan x: Float = this.x, @ZoomApi.ScaledPan y: Float = this.y) {
this.x = x
this.y = y
}

/**
* 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)
}

/**
* 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)
}

}
Loading