Languages

Menu
Sites
Language
More options popup (ASAP)

Hello Guys.

I am working with "More options" popup.It works fine but as the items in the popup increases the Rortary Event i.eBezel movement is not working in clock-wise direction as is has to.For this i have to move back the Bezel in anti-clock wise direction.So is there ant way we can change this behaviour.

"I have situtation ,number of item  1 to 15. As in the more options we can set max limit of contents is 11 items.So  as the number of item is more in our case,the remaining items is not availabe,as we go with rotray after 11.For this i have to move in anti-clock-wise direction,which does not seems to be a good approach.Please share your suggestions.I need to do this ASAP."

 

Edited by: Anubhav Gupta on 22 Sep, 2016

Responses

2 Replies
Iqbal Hossain

Hi~

You can control the rotary event.  Please use rotaryDetentHandler for you requirement. Check the direction and take your decision. CW for right direction and CCW for left direction.

  Please check below example,

<div class="ui-page" id="pageRotaryEvent" data-enable-page-scroll="false">
    	<header class="ui-header">
			<h2 class="ui-title">Rotary Event</h2>
	</header>
	<div class="ui-content">
	    <div id="result"></div>
	</div>
	<progress class="ui-circle-progress" id="circleprogress" max="100" value="20"></progress>
	<script src="rotaryEvent.js"></script>
</div>

 

And Js

(function(){
	var page = document.getElementById( "pageRotaryEvent" ),
		progressBar,
		progressBarWidget,
		rotaryDetentHandler;
	page.addEventListener("pagebeforeshow", function() {
		var resultDiv = document.getElementById("result"),
			direction,
			value;

		progressBar = document.getElementById("circleprogress");
		progressBarWidget = new tau.widget.CircleProgressBar(progressBar, {size: "large"});
		resultDiv.innerText = progressBarWidget.value() + "%";

		// "rotarydetent" event handler
		rotaryDetentHandler = function(e) {
			// Get rotary direction
			direction = e.detail.direction;

			if (direction === "CW") {
				// Right direction
				if (parseInt(progressBarWidget.value(), 10) < 100) {
					value = parseInt(progressBarWidget.value(), 10) + 1;
				} else {
					value = 100;
				}
			} else if (direction === "CCW") {
				// Left direction
				if (parseInt(progressBarWidget.value(), 10) > 0) {
					value = parseInt(progressBarWidget.value(), 10) - 1;
				} else {
					value = 0;
				}
			}

			resultDiv.innerText = value + "%";
			progressBarWidget.value(value);
		};

		// Add rotarydetent handler to document
		document.addEventListener("rotarydetent", rotaryDetentHandler);
	});

	/**
	 * pagehide event handler
	 * Destroys and removes event listeners
	 */
	page.addEventListener("pagehide", function() {
		progressBarWidget.destroy();
		document.removeEventListener("rotarydetent", rotaryDetentHandler);
	});
}());

 

Let me know if it helped you.

-Thanks

Anubhav Gupta

Thanks for your response.

But actually am using moreoptions.js and there is default working for rotray event and i can't change this.I hope you understand the problem.I need to solve this ASAP.Looking forward for some more answers.