mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 23:21:42 +03:00
Add documentation for opacity-change and composite-operation-change
- Add early exit to setOpacity/setCompositeOperation when new value is the same as current
This commit is contained in:
parent
035f35a26a
commit
1fb25f3e41
@ -774,9 +774,25 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
* @fires OpenSeadragon.TiledImage.event:opacity-change
|
||||
*/
|
||||
setOpacity: function(opacity) {
|
||||
if (opacity === this.opacity) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.opacity = opacity;
|
||||
this._needsDraw = true;
|
||||
this.raiseEvent('opacity-change');
|
||||
/**
|
||||
* Raised when the TiledImage's opacity is changed.
|
||||
* @event opacity-change
|
||||
* @memberOf OpenSeadragon.TiledImage
|
||||
* @type {object}
|
||||
* @property {Number} opacity - The new opacity value.
|
||||
* @property {OpenSeadragon.TiledImage} eventSource - A reference to the
|
||||
* TiledImage which raised the event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.raiseEvent('opacity-change', {
|
||||
opacity: this.opacity
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -833,9 +849,25 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
* @fires OpenSeadragon.TiledImage.event:composite-operation-change
|
||||
*/
|
||||
setCompositeOperation: function(compositeOperation) {
|
||||
if (compositeOperation === this.compositeOperation) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.compositeOperation = compositeOperation;
|
||||
this._needsDraw = true;
|
||||
this.raiseEvent('composite-operation-change');
|
||||
/**
|
||||
* Raised when the TiledImage's opacity is changed.
|
||||
* @event composite-operation-change
|
||||
* @memberOf OpenSeadragon.TiledImage
|
||||
* @type {object}
|
||||
* @property {String} compositeOperation - The new compositeOperation value.
|
||||
* @property {OpenSeadragon.TiledImage} eventSource - A reference to the
|
||||
* TiledImage which raised the event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.raiseEvent('composite-operation-change', {
|
||||
compositeOperation: this.compositeOperation
|
||||
});
|
||||
},
|
||||
|
||||
// private
|
||||
|
Loading…
x
Reference in New Issue
Block a user