event-controller: Use "scale" to refer to the current value in the zoom-controller
This changed both the emitted signal and the getter Signed-off-by: Carlos Garnacho <carlos@lanedo.com> Acked-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
parent
aa652b8754
commit
1a0ddf4d54
@ -106,7 +106,7 @@ _sugar_zoom_controller_check_emit (SugarZoomController *controller)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
zoom = distance / priv->initial_distance;
|
zoom = distance / priv->initial_distance;
|
||||||
g_signal_emit (controller, signals[ZOOM_CHANGED], 0, zoom);
|
g_signal_emit (controller, signals[SCALE_CHANGED], 0, zoom);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -161,15 +161,15 @@ sugar_zoom_controller_class_init (SugarZoomControllerClass *klass)
|
|||||||
controller_class->updated = sugar_zoom_controller_updated;
|
controller_class->updated = sugar_zoom_controller_updated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SugarZoomController::zoom-changed:
|
* SugarZoomController::scale-changed:
|
||||||
* @controller: the object on which the signal is emitted
|
* @controller: the object on which the signal is emitted
|
||||||
* @delta: Difference with the starting zooming state
|
* @scale: Difference with the starting zooming state
|
||||||
*/
|
*/
|
||||||
signals[ZOOM_CHANGED] =
|
signals[SCALE_CHANGED] =
|
||||||
g_signal_new ("zoom-changed",
|
g_signal_new ("scale-changed",
|
||||||
SUGAR_TYPE_ZOOM_CONTROLLER,
|
SUGAR_TYPE_ZOOM_CONTROLLER,
|
||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_FIRST,
|
||||||
G_STRUCT_OFFSET (SugarZoomControllerClass, zoom_changed),
|
G_STRUCT_OFFSET (SugarZoomControllerClass, scale_changed),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__DOUBLE,
|
g_cclosure_marshal_VOID__DOUBLE,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
@ -185,20 +185,20 @@ sugar_zoom_controller_new (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sugar_zoom_controller_get_zoom_delta:
|
* sugar_zoom_controller_get_scale_delta:
|
||||||
* @controller: a #SugarZoomController
|
* @controller: a #SugarZoomController
|
||||||
* @delta: (out) (transfer none): zoom delta
|
* @scale: (out) (transfer none): zoom delta
|
||||||
*
|
*
|
||||||
* If @controller is on state %SUGAR_EVENT_CONTROLLER_STATE_RECOGNIZED,
|
* If @controller is on state %SUGAR_EVENT_CONTROLLER_STATE_RECOGNIZED,
|
||||||
* this function returns %TRUE and fills in @delta with the zooming
|
* this function returns %TRUE and fills in @scale with the zooming
|
||||||
* difference since the gesture was recognized (hence the starting point
|
* difference since the gesture was recognized (hence the starting point
|
||||||
* is considered 1x).
|
* is considered 1x).
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if @controller is recognizing a zoom gesture
|
* Returns: %TRUE if @controller is recognizing a zoom gesture
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
sugar_zoom_controller_get_zoom_delta (SugarZoomController *controller,
|
sugar_zoom_controller_get_scale_delta (SugarZoomController *controller,
|
||||||
gdouble *delta)
|
gdouble *scale)
|
||||||
{
|
{
|
||||||
SugarZoomControllerPriv *priv;
|
SugarZoomControllerPriv *priv;
|
||||||
gdouble distance;
|
gdouble distance;
|
||||||
@ -210,8 +210,8 @@ sugar_zoom_controller_get_zoom_delta (SugarZoomController *controller,
|
|||||||
|
|
||||||
priv = controller->_priv;
|
priv = controller->_priv;
|
||||||
|
|
||||||
if (delta)
|
if (scale)
|
||||||
*delta = distance / priv->initial_distance;
|
*scale = distance / priv->initial_distance;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -51,14 +51,14 @@ struct _SugarZoomControllerClass
|
|||||||
{
|
{
|
||||||
SugarTouchControllerClass parent_class;
|
SugarTouchControllerClass parent_class;
|
||||||
|
|
||||||
void (* zoom_changed) (SugarZoomController *controller,
|
void (* scale_changed) (SugarZoomController *controller,
|
||||||
gdouble zoom);
|
gdouble scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType sugar_zoom_controller_get_type (void) G_GNUC_CONST;
|
GType sugar_zoom_controller_get_type (void) G_GNUC_CONST;
|
||||||
SugarEventController * sugar_zoom_controller_new (void);
|
SugarEventController * sugar_zoom_controller_new (void);
|
||||||
gboolean sugar_zoom_controller_get_zoom_delta (SugarZoomController *controller,
|
gboolean sugar_zoom_controller_get_scale_delta (SugarZoomController *controller,
|
||||||
gdouble *delta);
|
gdouble *scale);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user