Minsky
minsky::PannableTab< Base > Class Template Reference

Mixin implementing common panning functionality in tabs. More...

#include <pannableTab.h>

Inheritance diagram for minsky::PannableTab< Base >:
Inheritance graph
Collaboration diagram for minsky::PannableTab< Base >:
Collaboration graph

Public Member Functions

 PannableTab ()
 
template<class A >
 PannableTab (A &arg)
 
void mouseDown (float x, float y) override
 
void mouseUp (float x, float y) override
 
void mouseMove (float x, float y) override
 
void moveTo (float x, float y) override
 
std::vector< float > position () const override
 
void zoom (double x, double y, double z) override
 
double zoomFactor () const override
 

Private Member Functions

 CLASSDESC_ACCESS (PannableTab)
 

Private Attributes

bool mousePressed =false
 
float deltaX
 
float deltaY
 

Detailed Description

template<class Base>
class minsky::PannableTab< Base >

Mixin implementing common panning functionality in tabs.

Definition at line 36 of file pannableTab.h.

Constructor & Destructor Documentation

◆ PannableTab() [1/2]

template<class Base>
minsky::PannableTab< Base >::PannableTab ( )
inline

Definition at line 42 of file pannableTab.h.

42 {}

◆ PannableTab() [2/2]

template<class Base>
template<class A >
minsky::PannableTab< Base >::PannableTab ( A &  arg)
inline

Definition at line 43 of file pannableTab.h.

43 : Base(arg) {}

Member Function Documentation

◆ CLASSDESC_ACCESS()

template<class Base>
minsky::PannableTab< Base >::CLASSDESC_ACCESS ( PannableTab< Base >  )
private

◆ mouseDown()

template<class Base>
void minsky::PannableTab< Base >::mouseDown ( float  x,
float  y 
)
inlineoverride

Definition at line 44 of file pannableTab.h.

Referenced by minsky::PubTab::controlMouseDown(), and minsky::VariablePane::mouseDown().

45  {
46  deltaX=x-Base::offsx;
47  deltaY=y-Base::offsy;
48  mousePressed=true;
49  }
Here is the caller graph for this function:

◆ mouseMove()

template<class Base>
void minsky::PannableTab< Base >::mouseMove ( float  x,
float  y 
)
inlineoverride

Definition at line 55 of file pannableTab.h.

Referenced by minsky::PannableTab< VariablePaneBase >::mouseUp().

56  {
57  if (mousePressed)
58  {
59  Base::offsx=x-deltaX;
60  Base::offsy=y-deltaY;
61  Base::requestRedraw();
62  }
63  }
Here is the caller graph for this function:

◆ mouseUp()

template<class Base>
void minsky::PannableTab< Base >::mouseUp ( float  x,
float  y 
)
inlineoverride

Definition at line 50 of file pannableTab.h.

51  {
52  mouseMove(x,y);
53  mousePressed=false;
54  }
void mouseMove(float x, float y) override
Definition: pannableTab.h:55

◆ moveTo()

template<class Base>
void minsky::PannableTab< Base >::moveTo ( float  x,
float  y 
)
inlineoverride

Definition at line 64 of file pannableTab.h.

65  {
66  Base::offsx=x;
67  Base::offsy=y;
68  Base::requestRedraw();
69  }

◆ position()

template<class Base>
std::vector<float> minsky::PannableTab< Base >::position ( ) const
inlineoverride

Definition at line 70 of file pannableTab.h.

71  {
72  return {Base::offsx, Base::offsy};
73  }

◆ zoom()

template<class Base>
void minsky::PannableTab< Base >::zoom ( double  x,
double  y,
double  z 
)
inlineoverride

Definition at line 74 of file pannableTab.h.

74  {
75  Base::offsx=x+(Base::offsx-x)*z;
76  Base::offsy=y+(Base::offsy-y)*z;
77  Base::m_zoomFactor*=z;
78  Base::requestRedraw();
79  }

◆ zoomFactor()

template<class Base>
double minsky::PannableTab< Base >::zoomFactor ( ) const
inlineoverride

Definition at line 81 of file pannableTab.h.

81 {return Base::m_zoomFactor;}

Member Data Documentation

◆ deltaX

template<class Base>
float minsky::PannableTab< Base >::deltaX
private

◆ deltaY

template<class Base>
float minsky::PannableTab< Base >::deltaY
private

◆ mousePressed


The documentation for this class was generated from the following file: