src/world.js
function( item, options ) {
        $.console.assert(item, "[World.addItem] item is required");
        $.console.assert(item instanceof $.TiledImage, "[World.addItem] only TiledImages supported at this time");

        options = options || {};
        if (options.index !== undefined) {
            var index = Math.max(0, Math.min(this._items.length, options.index));
            this._items.splice(index, 0, item);
        } else {
            this._items.push( item );
        }

        if (this._autoRefigureSizes) {
            this._figureSizes();
        } else {
            this._needsSizesFigured = true;
        }

        this._needsDraw = true;

        item.addHandler('bounds-change', this._delegatedFigureSizes);
        item.addHandler('clip-change', this._delegatedFigureSizes);

        /**
         * Raised when an item is added to the World.
         * @event add-item
         * @memberOf OpenSeadragon.World
         * @type {object}
         * @property {OpenSeadragon.Viewer} eventSource - A reference to the World which raised the event.
         * @property {OpenSeadragon.TiledImage} item - The item that has been added.
         * @property {?Object} userData - Arbitrary subscriber-defined object.
         */
        this.raiseEvent( 'add-item', {
            item: item
        } );
    }
function( item, options ) {
        $.console.assert(item, "[World.addItem] item is required");
        $.console.assert(item instanceof $.TiledImage, "[World.addItem] only TiledImages supported at this time");

        options = options || {};
        if (options.index !== undefined) {
            var index = Math.max(0, Math.min(this._items.length, options.index));
            this._items.splice(index, 0, item);
        } else {
            this._items.push( item );
        }

        if (this._autoRefigureSizes) {
            this._figureSizes();
        } else {
            this._needsSizesFigured = true;
        }

        this._needsDraw = true;

        item.addHandler('bounds-change', this._delegatedFigureSizes);
        item.addHandler('clip-change', this._delegatedFigureSizes);

        /**
         * Raised when an item is added to the World.
         * @event add-item
         * @memberOf OpenSeadragon.World
         * @type {object}
         * @property {OpenSeadragon.Viewer} eventSource - A reference to the World which raised the event.
         * @property {OpenSeadragon.TiledImage} item - The item that has been added.
         * @property {?Object} userData - Arbitrary subscriber-defined object.
         */
        this.raiseEvent( 'add-item', {
            item: item
        } );
    }
function ( item , options ) { $ . console . assert ( item , "[World.addItem] item is required" ) ; $ . console . assert ( item instanceof $ . TiledImage , "[World.addItem] only TiledImages supported at this time" ) ; options = options || { } ; if ( options . index !== undefined ) { var index = Math . max ( 0 , Math . min ( this . _items . length , options . index ) ) ; this . _items . splice ( index , 0 , item ) ; } else { this . _items . push ( item ) ; } if ( this . _autoRefigureSizes ) { this . _figureSizes ( ) ; } else { this . _needsSizesFigured = true ; } this . _needsDraw = true ; item . addHandler ( 'bounds-change' , this . _delegatedFigureSizes ) ; item . addHandler ( 'clip-change' , this . _delegatedFigureSizes ) ; /**
         * Raised when an item is added to the World.
         * @event add-item
         * @memberOf OpenSeadragon.World
         * @type {object}
         * @property {OpenSeadragon.Viewer} eventSource - A reference to the World which raised the event.
         * @property {OpenSeadragon.TiledImage} item - The item that has been added.
         * @property {?Object} userData - Arbitrary subscriber-defined object.
         */ this . raiseEvent ( 'add-item' , { item : item } ) ; }
Add the specified item.
@param {OpenSeadragon.TiledImage} item - The item to add.
@param {Number} [options.index] - Index for the item. If not specified, goes at the top.
@fires OpenSeadragon.World.event:add-item
@fires OpenSeadragon.World.event:metrics-change
Add the specified item .