diff --git a/doc/manual/en/config/widgets/plugins/controllerinput/index.rst b/doc/manual/en/config/widgets/plugins/controllerinput/index.rst index 7be8378134e..fa2c3a1d985 100644 --- a/doc/manual/en/config/widgets/plugins/controllerinput/index.rst +++ b/doc/manual/en/config/widgets/plugins/controllerinput/index.rst @@ -98,6 +98,9 @@ current design are given. .. figure:: widgets/plugins/controllerinput/_static/design_schema.png :alt: Design schema +``--check-hover`` Inform the browser to check mouse entry and exit to apply + :hover rules. + .. rubric:: Footnotes .. [#f1] The simple view might not show everything. To see all elements/attributes use the expert view. \ No newline at end of file diff --git a/source/class/cv/plugins/ControllerInput.js b/source/class/cv/plugins/ControllerInput.js index 94936b8a21b..9d7f737ed87 100644 --- a/source/class/cv/plugins/ControllerInput.js +++ b/source/class/cv/plugins/ControllerInput.js @@ -238,7 +238,7 @@ qx.Class.define('cv.plugins.ControllerInput', { if (!this.$$domReady) { var pageId = this.getParentPage().getPath(); var broker = qx.event.message.Bus; - + // stop refreshing when page is left broker.subscribe("path." + pageId + ".exitingPageChange", function () { this._stopRefresh(this._timer); @@ -260,56 +260,62 @@ qx.Class.define('cv.plugins.ControllerInput', { }, this); // create paths to show + this.__background = qx.bom.Selector.query('.controllerinputBackground path', this.getDomElement())[0]; + this.__currentClip = qx.bom.Selector.query('.controllerinputCurrent #clip > path', this.getDomElement())[0]; + this.__current = qx.bom.Selector.query('.controllerinputCurrent .current', this.getDomElement())[0]; + this.__handle = qx.bom.Selector.query('.controllerinputHandle path', this.getDomElement())[0]; + this.__handleOuter = qx.bom.Selector.query('.controllerinputHandleValueOuter', this.getDomElement())[0]; + this.__handleInner = qx.bom.Selector.query('.controllerinputHandleValueInner', this.getDomElement())[0]; + this.__value = qx.bom.Selector.query('.actor > .value', this.getDomElement())[0]; + var - background = qx.bom.Selector.query('.controllerinputBackground path', this.getDomElement())[0], - backgroundDim = cv.plugins.ControllerInput.getDimensionsFromElement( background ), + backgroundDim = cv.plugins.ControllerInput.getDimensionsFromElement( this.__background ), backgroundD = cv.plugins.ControllerInput.createArcPath( backgroundDim.r, backgroundDim.width, backgroundDim.borderRadius, backgroundDim.leftM, backgroundDim.rightM ), - currentClip = qx.bom.Selector.query('.controllerinputCurrent #clip > path', this.getDomElement())[0], - currentClipDim = cv.plugins.ControllerInput.getDimensionsFromElement( currentClip ), + currentClipDim = cv.plugins.ControllerInput.getDimensionsFromElement( this.__currentClip ), currentClipD = cv.plugins.ControllerInput.createArcPath( currentClipDim.r, currentClipDim.width, currentClipDim.borderRadius, currentClipDim.leftM, currentClipDim.rightM ), - current = qx.bom.Selector.query('.controllerinputCurrent .current', this.getDomElement())[0], - currentDim = cv.plugins.ControllerInput.getDimensionsFromElement( current ), + currentDim = cv.plugins.ControllerInput.getDimensionsFromElement( this.__current ), currentD = cv.plugins.ControllerInput.createArcPath( currentDim.r, currentDim.width, currentDim.borderRadius, currentDim.leftM, currentDim.rightM ), - handle = qx.bom.Selector.query('.controllerinputHandle path', this.getDomElement())[0], - handleDim = cv.plugins.ControllerInput.getDimensionsFromElement( handle ), + handleDim = cv.plugins.ControllerInput.getDimensionsFromElement( this.__handle ), handleD = cv.plugins.ControllerInput.createArcPath( handleDim.r, handleDim.width, handleDim.borderRadius, 0, Math.PI-handleDim.leftP-handleDim.rightP ); - background.setAttribute('d',backgroundD); + this.__background.setAttribute('d',backgroundD); if( undefined !== backgroundDim.fill ) { - background.insertAdjacentHTML( + this.__background.insertAdjacentHTML( 'beforebegin', ' ' ); - background.setAttribute('style','fill:url(#Gradient1)'); + this.__background.setAttribute('style','fill:url(#Gradient1)'); } - currentClip.setAttribute('d',currentClipD); - current.setAttribute('d',currentD); + this.__currentClip.setAttribute('d',currentClipD); + this.__current.setAttribute('d',currentD); this._currentSize = 180 - (currentDim.leftM+currentDim.rightM)*180/Math.PI; - handle.setAttribute('d',handleD); + this.__handle.setAttribute('d',handleD); this._handleStartOffset = handleDim.leftM*180/Math.PI; this._handleRange = 180 - (handleDim.leftM+handleDim.leftP+handleDim.rightP+handleDim.rightM)*180/Math.PI; this._handleCenterStartOffset = (handleDim.leftM+handleDim.leftP)*180/Math.PI; this._handleCenterRange = 180 - (handleDim.rightP+handleDim.rightM)*180/Math.PI - this._handleCenterStartOffset; qx.bom.element.Style.set( - handle, + this.__handle, 'transform', 'rotate('+this._handleStartOffset+'deg)' ); // observe for style changes to ba able to update paths - var checkHover = window.getComputedStyle( handle ).getPropertyValue('--check-hover'); + var checkHover = window.getComputedStyle( this.__handle ).getPropertyValue('--check-hover'); if( 'true' === checkHover.trim() ) { - var callbackHover = function() - { - handleDim = cv.plugins.ControllerInput.getDimensionsFromElement( handle ); - handleD = cv.plugins.ControllerInput.createArcPath( handleDim.r, handleDim.width, handleDim.borderRadius, 0, Math.PI-handleDim.leftP-handleDim.rightP ); - handle.setAttribute('d',handleD); - } - handle.addEventListener( 'mouseenter', callbackHover ); - handle.addEventListener( 'mouseleave', callbackHover ); + var + handle = this.__handle, + callbackHover = function() + { + handleDim = cv.plugins.ControllerInput.getDimensionsFromElement( handle ); + handleD = cv.plugins.ControllerInput.createArcPath( handleDim.r, handleDim.width, handleDim.borderRadius, 0, Math.PI-handleDim.leftP-handleDim.rightP ); + handle.setAttribute('d',handleD); + }; + this.__handle.addEventListener( 'mouseenter', callbackHover ); + this.__handle.addEventListener( 'mouseleave', callbackHover ); } // initialize the diagram but don't make the initialization process wait for it @@ -370,10 +376,17 @@ qx.Class.define('cv.plugins.ControllerInput', { + '' + '' + '' - + '
|X|
' + + '
' + '' + '
-
' + this.getMin() + '
' + this.getMax() + '
'; }, + + // overridden + getValueElement: function() { + if( 'setpoint' === this._updateElement ) + return this.__handleInner; + return this.__value; + }, _setupRefreshAction: function() { if (this.getRefresh()) { @@ -462,17 +475,13 @@ qx.Class.define('cv.plugins.ControllerInput', { }, updateSetpoint: function ( id, format, value, ratio ) { - var - handle = qx.bom.Selector.query('.controllerinputHandle path', this.getDomElement())[0], - handleVO = qx.bom.Selector.query('.controllerinputHandleValueOuter', this.getDomElement())[0], - handleVI = qx.bom.Selector.query('.controllerinputHandleValueInner', this.getDomElement())[0]; - qx.bom.element.Style.set( handle, + qx.bom.element.Style.set( this.__handle, 'transform', 'rotate('+(this._handleStartOffset+this._handleRange*ratio)+'deg)' ); - qx.bom.element.Style.set( handleVO, + qx.bom.element.Style.set( this.__handleOuter, 'transform', 'rotate('+(this._handleStartOffset+this._handleRange*ratio)+'deg)' ); - qx.bom.element.Style.set( handleVI, + qx.bom.element.Style.set( this.__handleInner, 'transform', 'rotate('+(-this._handleStartOffset-this._handleRange*ratio)+'deg)' ); }, @@ -533,10 +542,9 @@ qx.Class.define('cv.plugins.ControllerInput', { switch (this.getAddress()[ga][2]) { case 'actual': - var - current = qx.bom.Selector.query('.controllerinputCurrent .current', this.getDomElement())[0]; - qx.bom.element.Style.set( current, 'transform', 'rotate(-'+((1-ratio)*this._currentSize)+'deg)' ); + qx.bom.element.Style.set( this.__current, 'transform', 'rotate(-'+((1-ratio)*this._currentSize)+'deg)' ); + this._updateElement = 'actual'; this.defaultUpdate(ga, d, this.getDomElement(), true, this.getPath()); if( hasPlot ) { @@ -554,7 +562,8 @@ qx.Class.define('cv.plugins.ControllerInput', { break; case 'setpoint': - this.debug('setpoint', value, this._inAction); + this._updateElement = 'setpoint'; + this.defaultUpdate(ga, d, this.getDomElement(), true, this.getPath()); if (!this._inAction) { this.updateSetpoint(this.getPath(), this.getFormat(), value, ratio); }