Skip to content

Commit fd45eb4

Browse files
author
Koen Deforche
committed
Several changes:
- Added TargetDownload for Anchors and PushButton - Fix js exception thrown with new version of tinyMCE - Possibly fix #4417: the child process is stopped before it can generate a new session. - Fixed bounds limiting for horizontal charts - WAxisSliderWidget: Rescue render state from being overridden by render - add unsetDraggable in WInteractiveWidget #3814 - Only setFormObject(true) when WPaintedWidget is inside WApplication - WCartesianChart: setInitialZoom/Pan -> setZoom/Pan, WPaintedWidget formData synced from client to server - Update Hostname if session reload is false and user hostname used to access server changed (#3730) - Interactive charts: configurable mouse wheel modifiers (merges the Bruce Toll's patch in issue #4373, with some changes) - Update tooltip locations with interactive WCartesianChart (merge of Bruce Toll's patches provided in issue #4358) - Fix autoplay not working in progressive bootstrap in chrome - WAxisSliderWideget: Disable slider widget, erase canvas, and log error when series is not line series of curve series - WCartesianChart: Perform corrections for rotated labels - WTemplate: fix !encodeTemplateText() behavior - WCartesianChart: Fix rotated axis label text clipping issue - WCartesianChart: touch interaction sort of working on FF nightly - WEnvironment: also read protocol from an X-Forwarded- header - fix JSon serialization of doubles, and fix JWt url encoding from WServer::post - Fix IE8 no longer working with Wt - fix #469 (do not require first to select before dragging an item)
1 parent 08037a7 commit fd45eb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1480
-424
lines changed

src/Wt/Chart/WAxis

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -614,20 +614,22 @@ public:
614614
*/
615615
virtual WString label(double u) const;
616616

617-
/*! \brief Sets the initial zoom level for this axis.
617+
/*! \brief Sets the zoom level for this axis.
618618
*
619619
* Only applies to a WCartesianChart in interactive mode.
620620
* The zoom level should be >= 1 and smaller than maxZoom()
621621
*
622622
* \note This is only implemented for the X and first Y axis. It has no effect on the second Y axis.
623623
*/
624-
void setInitialZoom(double initialZoom);
624+
void setZoom(double zoom);
625625

626-
/*! \brief Get the initial zoom level for this axis.
626+
/*! \brief Get the zoom level for this axis.
627627
*
628-
* \see setInitialZoom()
628+
* \note If the zoom level has been changed on the client side, this may not reflect the actual zoom level.
629+
*
630+
* \see setZoom()
629631
*/
630-
double initialZoom() const;
632+
double zoom() const;
631633

632634
/*! \brief Sets the maximum zoom level for this axis.
633635
*
@@ -644,7 +646,7 @@ public:
644646
*/
645647
double maxZoom() const;
646648

647-
/*! \brief Sets the initial value to pan to for this axis.
649+
/*! \brief Sets the value to pan to for this axis.
648650
*
649651
* This sets the leftmost (horizontal axis)
650652
* or bottom (vertical axis) value to be displayed on the chart.
@@ -653,17 +655,20 @@ public:
653655
* the panning of the chart will be automatically adjusted.
654656
*
655657
* Only applies to a WCartesianChart in interactive mode.
656-
* The zoom level should be >= 1 and smaller than maxZoom()
657658
*
658659
* \note This is only implemented for the X and first Y axis. It has no effect on the second Y axis.
660+
*
661+
* \note If the pan position has been changed on the client side, this may not reflect the actual pan position.
659662
*/
660-
void setInitialPan(double initialPan);
663+
void setPan(double pan);
661664

662-
/*! \brief Get the initial value to pan to for this axis, when pan is enabled on the chart.
665+
/*! \brief Get the value to pan to for this axis, when pan is enabled on the chart.
666+
*
667+
* \note
663668
*
664-
* \see setInitialPan()
669+
* \see setPan()
665670
*/
666-
double initialPan() const;
671+
double pan() const;
667672

668673
/*! \brief Sets the padding between the chart area and this axis.
669674
*
@@ -749,7 +754,7 @@ protected:
749754

750755
/*! \brief Represents a label/tick on the axis.
751756
*/
752-
struct TickLabel {
757+
struct WT_API TickLabel {
753758
/*! \brief Enumeration for a tick type */
754759
enum TickLength { Zero, Short, Long };
755760

@@ -800,8 +805,10 @@ private:
800805
WPen textPen_;
801806
Orientation titleOrientation_;
802807
double maxZoom_;
803-
double initialZoom_;
804-
double initialPan_;
808+
double zoom_;
809+
double pan_;
810+
bool zoomDirty_;
811+
bool panDirty_;
805812
int padding_;
806813
TickDirection tickDirection_;
807814

@@ -845,6 +852,7 @@ private:
845852
friend class WCartesianChart;
846853
friend class WCartesian3DChart;
847854
friend class WChart2DRenderer;
855+
friend class WAxisSliderWidget;
848856
};
849857

850858
template <typename T>

src/Wt/Chart/WAxis.C

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ WAxis::WAxis()
145145
textPen_(black),
146146
titleOrientation_(Horizontal),
147147
maxZoom_(4),
148-
initialZoom_(1),
149-
initialPan_(0),
148+
zoom_(1),
149+
pan_(0),
150+
zoomDirty_(true),
151+
panDirty_(true),
150152
padding_(0),
151153
tickDirection_(Outwards)
152154
{
@@ -1055,24 +1057,26 @@ WString WAxis::label(double u) const
10551057
return text;
10561058
}
10571059

1058-
void WAxis::setInitialZoom(double initialZoom)
1060+
void WAxis::setZoom(double zoom)
10591061
{
1060-
set(initialZoom_, initialZoom);
1062+
set(zoom_, zoom);
1063+
zoomDirty_ = true;
10611064
}
10621065

1063-
double WAxis::initialZoom() const
1066+
double WAxis::zoom() const
10641067
{
1065-
return initialZoom_;
1068+
return zoom_;
10661069
}
10671070

1068-
void WAxis::setInitialPan(double initialPan)
1071+
void WAxis::setPan(double pan)
10691072
{
1070-
set(initialPan_, initialPan);
1073+
set(pan_, pan);
1074+
zoomDirty_ = true;
10711075
}
10721076

1073-
double WAxis::initialPan() const
1077+
double WAxis::pan() const
10741078
{
1075-
return initialPan_;
1079+
return pan_;
10761080
}
10771081

10781082
void WAxis::setPadding(int padding)
@@ -1607,6 +1611,7 @@ void WAxis::renderLabel(WPainter& painter,
16071611
painter.save();
16081612
painter.translate(transform.map(pos));
16091613
painter.rotate(-angle);
1614+
transformedPoint = painter.worldTransform().inverted().map(transformedPoint);
16101615
painter.drawText(WRectF(left - pos.x(), top - pos.y(), width, height),
16111616
horizontalAlign | verticalAlign, TextSingleLine, text,
16121617
clipping ? &transformedPoint : 0);

src/Wt/Chart/WAxisSliderWidget

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ public:
134134
*/
135135
bool isAutoLayoutEnabled() const { return autoPadding_; }
136136

137+
/*! \brief Set whether to draw the X axis tick labels on the slider widget.
138+
*
139+
* Labels are enabled by default.
140+
*/
141+
void setLabelsEnabled(bool enabled = true);
142+
143+
/*! \brief Returns whether the X axis tick labels are drawn.
144+
*
145+
* \sa setLabelsEnabled()
146+
*/
147+
bool isLabelsEnabled() const { return labelsEnabled_; }
148+
137149
protected:
138150
virtual void render(WFlags<RenderFlag> flags) WT_CXX11ONLY(override) ;
139151
virtual void paintEvent(WPaintDevice *paintDevice) WT_CXX11ONLY(override) ;
@@ -152,6 +164,7 @@ private:
152164
WBrush background_;
153165
WBrush selectedAreaBrush_;
154166
bool autoPadding_;
167+
bool labelsEnabled_;
155168
int padding_[4];
156169

157170
WJavaScriptHandle<WTransform> transform_;

0 commit comments

Comments
 (0)