summaryrefslogtreecommitdiffstats
path: root/src/live_effects/effect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects/effect.cpp')
-rw-r--r--src/live_effects/effect.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 1a64defd9..fbdc78f8a 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -75,8 +75,6 @@
#include <glibmm/i18n.h>
#include "ui/tools/pen-tool.h"
#include "ui/tools-switch.h"
-#include "message-stack.h"
-#include "desktop.h"
#include "knotholder.h"
#include "sp-lpe-item.h"
#include "live_effects/lpeobject.h"
@@ -370,6 +368,7 @@ Effect::Effect(LivePathEffectObject *lpeobject)
{
registerParameter( dynamic_cast<Parameter *>(&is_visible) );
is_visible.widget_is_visible = false;
+ current_zoom = 0.0;
}
Effect::~Effect()
@@ -398,6 +397,36 @@ Effect::doOnApply (SPLPEItem const*/*lpeitem*/)
{
}
+void
+Effect::setSelectedNodePoints(std::vector<Geom::Point> sNP)
+{
+ selectedNodesPoints = sNP;
+}
+
+void
+Effect::setCurrentZoom(double cZ)
+{
+ current_zoom = cZ;
+}
+
+bool
+Effect::isNodePointSelected(Geom::Point const &nodePoint) const
+{
+ if (selectedNodesPoints.size() > 0) {
+ for (std::vector<Geom::Point>::const_iterator i = selectedNodesPoints.begin();
+ i != selectedNodesPoints.end(); ++i) {
+ Geom::Point p = *i;
+ std::cout << p << "p\n";
+ p[Geom::X] = Inkscape::Util::Quantity::convert(p[Geom::X], "px", *defaultUnit);
+ p[Geom::Y] = Inkscape::Util::Quantity::convert(p[Geom::Y], "px", *defaultUnit);
+ if (Geom::are_near(p, nodePoint, 0.01)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
/**
* Is performed each time before the effect is updated.
*/
@@ -419,6 +448,7 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/)
void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
+ defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr;
/*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve();
pathvector_before_effect = sp_curve->get_pathvector();*/
doOnApply(lpeitem);
@@ -427,6 +457,7 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
+ defaultUnit = &sp_lpe_item->document->getDefaultUnit()->abbr;
//printf("(SPLPEITEM*) %p\n", sp_lpe_item);
sp_curve = SP_SHAPE(sp_lpe_item)->getCurve();
pathvector_before_effect = sp_curve->get_pathvector();