summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 954579e)
raw | patch | inline | side by side (parent: 954579e)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 30 Jul 2008 12:05:20 +0000 (12:05 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 30 Jul 2008 12:05:20 +0000 (12:05 +0000) |
src/live_effects/parameter/text.cpp | patch | blob | history | |
src/live_effects/parameter/text.h | patch | blob | history |
index fab69578ad20fbd86d11d2ec87928f13b9ae8ebc..dea750091c96c4595fce2ea54c1b0d53e14996cc 100644 (file)
#include "ui/widget/registered-widget.h"
#include "inkscape.h"
#include "verbs.h"
+#include <2geom/sbasis-geometric.h>
namespace Inkscape {
sp_canvastext_set_coords (canvas_text, pos);
}
+void
+TextParam::setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
+ const double t, const double length, bool use_curvature)
+{
+ using namespace Geom;
+
+ Piecewise<D2<SBasis> > pwd2_reparam = arc_length_parametrization(pwd2, 2 , 0.1);
+ double t_reparam = pwd2_reparam.cuts.back() * t;
+ Point pos = pwd2_reparam.valueAt(t_reparam);
+ Point dir = unit_vector(derivative(pwd2_reparam).valueAt(t_reparam));
+ Point n = -rot90(dir);
+ double angle = Geom::angle_between(dir, Point(1,0));
+
+ sp_canvastext_set_coords(canvas_text, pos + n * length);
+ sp_canvastext_set_anchor(canvas_text, std::sin(angle), -std::cos(angle));
+}
+
void
TextParam::setAnchor(double x_value, double y_value)
{
index c3eddd9fa1a28e4808317ad35c171d7f01003c65..fafe9fe32384711f7a3a0f206b825d3e2312206f 100644 (file)
void param_setValue(const Glib::ustring newvalue);
virtual void param_set_default();
void setPos(Geom::Point pos);
+ void setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
+ const double t, const double length, bool use_curvature = false);
void setAnchor(double x_value, double y_value);
const Glib::ustring get_value() { return defvalue; };