1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Storytelling
- * (C) Copyright IBM Corp. 2014, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['baglass/core-client/js/core-client/ui/core/View', 'jquery'], function (View, $) {
- var SnapIndicatorView = View.extend({
- id: null,
- snapIndicatorRefreshInverval: 100,
- snapIndicatorTimer: null,
- events: {},
- init: function init(options) {
- SnapIndicatorView.inherited('init', this, arguments);
- this.$slidersHolder = options.$slidersHolder;
- this.id = options.id;
- this.controller = options.controller;
- this.scaleManager = options.scaleManager;
- this.$snapIndicator = $(document.createElement('div')).addClass('guideline').css({
- position: 'absolute',
- height: '100%',
- zIndex: 1066,
- top: 0,
- display: 'block'
- });
- },
- /**
- * Renders the timeline
- *
- * @returns
- */
- render: function render() {
- return this;
- },
- refreshSnapIndicator: function refreshSnapIndicator(getDragValue, getDraggingElement) {
- this.$snapIndicator.css('height', Math.max(this.controller.getTimelineEpisodeCount() * $('.sliderContent').height() + 50, this.$slidersHolder.height() + 50));
- this.isDragging = true;
- this.$snapIndicator.remove();
- var dragValue = getDragValue();
- if (dragValue) {
- var startTime = dragValue[0] * 1000;
- var endTime = dragValue[1] * 1000;
- var snapIndicatorTime = this.controller.getSnapIndicatorTime([startTime, endTime], getDraggingElement());
- if (snapIndicatorTime.changed === 'start') {
- this.$snapIndicator.css('left', this.scaleManager.convertTimeToPosition(snapIndicatorTime.timeRange[0]));
- this.$slidersHolder.append(this.$snapIndicator);
- } else if (snapIndicatorTime.changed === 'end') {
- this.$snapIndicator.css('left', this.scaleManager.convertTimeToPosition(snapIndicatorTime.timeRange[1]));
- this.$slidersHolder.append(this.$snapIndicator);
- }
- }
- },
- showIndicator: function showIndicator(getDragValue, getDraggingElement) {
- this.snapIndicatorTimer = setInterval(this.refreshSnapIndicator.bind(this, getDragValue, getDraggingElement), this.snapIndicatorRefreshInverval);
- },
- removeIndicator: function removeIndicator() {
- if (this.snapIndicatorTimer) {
- clearInterval(this.snapIndicatorTimer);
- }
- this.snapIndicatorTimer = null;
- this.$snapIndicator.remove();
- }
- });
- return SnapIndicatorView;
- });
- //# sourceMappingURL=SnapIndicatorView.js.map
|