Added jsdocs.

This commit is contained in:
Richard Davey 2018-01-26 00:37:50 +00:00
parent 065235a9f4
commit c168daee3f
3 changed files with 44 additions and 8 deletions

View file

@ -1,7 +1,19 @@
/**
* @module Phaser.Display.Canvas.CanvasInterpolation
* @since 3.0.0
*/
var CanvasInterpolation = {
// Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit).
// Note that if this doesn't given the desired result then see the setSmoothingEnabled.
/**
* Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit).
*
* @function setCrisp
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.
*
* @return {HTMLCanvasElement} The canvas.
*/
setCrisp: function (canvas)
{
var types = [ 'optimizeSpeed', 'crisp-edges', '-moz-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'pixelated' ];
@ -16,8 +28,16 @@ var CanvasInterpolation = {
return canvas;
},
// Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto').
// Note that if this doesn't given the desired result then see the CanvasUtils.setSmoothingEnabled method.
/**
* Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto').
*
* @function setBicubic
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas object to have the style set on.
*
* @return {HTMLCanvasElement} The canvas.
*/
setBicubic: function (canvas)
{
canvas.style['image-rendering'] = 'auto';

View file

@ -1,6 +1,14 @@
/**
* Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions.
*/
* Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions.
*
* @function Phaser.Display.Canvas.TouchAction
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to.
* @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions.
*
* @return {HTMLCanvasElement} The canvas element.
*/
var TouchAction = function (canvas, value)
{
if (value === undefined) { value = 'none'; }

View file

@ -1,6 +1,14 @@
/**
* Sets the user-select property on the canvas style. Can be used to disable default browser selection actions.
*/
* Sets the user-select property on the canvas style. Can be used to disable default browser selection actions.
*
* @function Phaser.Display.Canvas.UserSelect
* @since 3.0.0
*
* @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to.
* @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts.
*
* @return {HTMLCanvasElement} The canvas element.
*/
var UserSelect = function (canvas, value)
{
if (value === undefined) { value = 'none'; }