@@ -107,7 +107,7 @@ public void onLayoutChange(
107107
108108 private float tooltipScaleX = 1F ;
109109 private float tooltipScaleY = 1F ;
110- private final float tooltipPivotX = 0.5F ;
110+ private float tooltipPivotX = 0.5F ;
111111 private float tooltipPivotY = 0.5F ;
112112 private float labelOpacity = 1.0F ;
113113
@@ -366,15 +366,24 @@ public void setLayoutMargin(@Px int layoutMargin) {
366366 * @param fraction A value between 0.0 and 1.0 that defines how "shown" the tooltip will be.
367367 */
368368 public void setRevealFraction (@ FloatRange (from = 0.0 , to = 1.0 ) float fraction ) {
369- // Set the y pivot point below the bottom of the tooltip to make it look like the
370- // tooltip is translating slightly up while scaling in.
371- tooltipPivotY = 1.2F ;
372369 tooltipScaleX = fraction ;
373370 tooltipScaleY = fraction ;
374371 labelOpacity = AnimationUtils .lerp (0F , 1F , 0.19F , 1F , fraction );
375372 invalidateSelf ();
376373 }
377374
375+ /**
376+ * Set the pivot points for the tooltip.
377+ *
378+ * @hide
379+ */
380+ @ RestrictTo (LIBRARY_GROUP )
381+ public void setPivots (float pivotX , float pivotY ) {
382+ this .tooltipPivotX = pivotX ;
383+ this .tooltipPivotY = pivotY ;
384+ invalidateSelf ();
385+ }
386+
378387 /**
379388 * Should be called to allow this drawable to calculate its position within the current display
380389 * frame. This allows it to apply to specified window padding.
@@ -486,7 +495,7 @@ private float calculatePointerOffset() {
486495 private EdgeTreatment createMarkerEdge () {
487496 float offset = -calculatePointerOffset ();
488497 // The maximum distance the arrow can be offset before extends outside the bounds.
489- float maxArrowOffset = (float ) (getBounds ().width () - arrowSize * Math .sqrt (2 )) / 2.0f ;
498+ float maxArrowOffset = (float ) (( getBounds ().width () - arrowSize * Math .sqrt (2 )) / 2.0f ) ;
490499 offset = Math .max (offset , -maxArrowOffset );
491500 offset = Math .min (offset , maxArrowOffset );
492501 return new OffsetEdgeTreatment (new MarkerEdgeTreatment (arrowSize ), offset );
0 commit comments