Sencha Touch Knob

This plugin provides images with capabilities of a knob. It works with Sencha Touch 2 and above.


Project maintained by blessenm Hosted on GitHub Pages — Theme by mattgraham

Sencha Touch Knob

This is a plugin that can be added to an image class of sencha touch 2 and above. This provides various functionality of a rotating knob. There are currently 3 modes the knob will work.

Go to the demo page to see it in action.

  1. Continous

    Here the knob will rotate a whole 360 degree angle.

  2. Sectors

    Here the 360 degree will be divided into a number of sectors. So the knob will only snap to middle of the sector.

  3. Arc

    We can specify and arc range in degree's and an offset angle. In this mode, the knob will only rotate in the specified arc range.

Documentation

Config

Events

  1. turn

    This event will fire for the image the plugin is attached to.

    Parameters

  * angle

    Angle at which the knob is rotated to.  
    0 starts from the top and move's in clockwise direction.

  * value

    Value of the knob.  
    For continous mode, the value will be the same as the angle.  
    For sectors mode, the value will be the sector number at which the knob is currently at.  
    For arc, mode, the value will be between 0, and the arcAngle.

Usage

For continous mode

{
    xtype:'img',
    src:'images/arrow.png',
    width:128,
    height:128,
    centered:true,
    plugins:[
        {
            xclass:'Ext.plugin.Knob'
        }
    ],
    listeners:{
        turn:function(angle,value){
        }
    }
}  

For sectors mode,

{
    xtype:'img',
    src:'images/arrow.png',
    width:128,
    height:128,
    centered:true,
    plugins:[
        {
            xclass:'Ext.plugin.Knob',
            sectorCount:12
        }
    ],
    listeners:{
        turn:function(angle,value){
        }
    }
}

For arc mode,

{
    xtype:'img',
    src:'images/arrow.png',
    width:128,
    height:128,
    centered:true,
    plugins:[
        {
            xclass:'Ext.plugin.Knob',
            arcAngle:270,
            arcOffset:45
        }
    ],
    listeners:{
        turn:function(angle,value){
        }
    }
} 

Version

1.0

1.1

Issues Or Contributions