diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js index 8801dadf4a5aeb64233476a12fd3c9671b076a64..2613ab49d00e93d6484cada741656ba767c37f71 100644 --- a/plugins/SegmentEditor/javascripts/Segmentation.js +++ b/plugins/SegmentEditor/javascripts/Segmentation.js @@ -815,6 +815,14 @@ Segmentation = (function($) { self.form = getFormHtml(); self.target.prepend(self.form); + // if there's enough space to the left & not enough space to the right, + // anchor the form to the right of the selector + if (self.form.width() + self.target.offset().left > $(window).width() + && self.form.width() < self.target.offset().left + self.target.width() + ) { + self.form.addClass('anchorRight'); + } + bindFormEvents(); bindSegmentManipulationEvents(); diff --git a/plugins/SegmentEditor/stylesheets/segmentation.less b/plugins/SegmentEditor/stylesheets/segmentation.less index a11ab7b9274c7f6d5c0c5d74cb26db58e36eb682..99819616a843b41b76bc60f194297e4b84387e31 100644 --- a/plugins/SegmentEditor/stylesheets/segmentation.less +++ b/plugins/SegmentEditor/stylesheets/segmentation.less @@ -698,4 +698,9 @@ a.metric_category { .segmentEditorPanel.visible { border-bottom-left-radius: 0; border-bottom-right-radius: 0; +} + +.segment-element.anchorRight { + right:-1px; + left:auto; } \ No newline at end of file