ResolutionPolicy 类型

模块: _decorator 父模块: cc

cc.ResolutionPolicy class is the root strategy class of scale strategy, its main task is to maintain the compatibility with Cocos2d-x

索引

属性(properties)
  • EXACT_FIT Number The entire application is visible in the specified area without trying to preserve the original aspect ratio.
    Distortion can occur, and the application may appear stretched or compressed.
  • NO_BORDER Number The entire application fills the specified area, without distortion but possibly with some cropping,
    while maintaining the original aspect ratio of the application.
  • SHOW_ALL Number The entire application is visible in the specified area without distortion while maintaining the original
    aspect ratio of the application. Borders can appear on two sides of the application.
  • FIXED_HEIGHT Number The application takes the height of the design resolution size and modifies the width of the internal
    canvas so that it fits the aspect ratio of the device
    no distortion will occur however you must make sure your application works on different
    aspect ratios
  • FIXED_WIDTH Number The application takes the width of the design resolution size and modifies the height of the internal
    canvas so that it fits the aspect ratio of the device
    no distortion will occur however you must make sure your application works on different
    aspect ratios
  • UNKNOWN Number Unknow policy
方法
  • constructor
  • preApply Manipulation before applying the resolution policy
  • apply Function to apply this resolution policy The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}}, The target view can then apply these value to itself, it's preferred not to modify directly its private variables
  • postApply Manipulation after appyling the strategy
  • setContainerStrategy Setup the container's scale strategy
  • setContentStrategy Setup the content's scale strategy

Details

属性(properties)

EXACT_FIT

The entire application is visible in the specified area without trying to preserve the original aspect ratio.
Distortion can occur, and the application may appear stretched or compressed.

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1466
NO_BORDER

The entire application fills the specified area, without distortion but possibly with some cropping,
while maintaining the original aspect ratio of the application.

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1475
SHOW_ALL

The entire application is visible in the specified area without distortion while maintaining the original
aspect ratio of the application. Borders can appear on two sides of the application.

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1484
FIXED_HEIGHT

The application takes the height of the design resolution size and modifies the width of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1493
FIXED_WIDTH

The application takes the width of the design resolution size and modifies the height of the internal
canvas so that it fits the aspect ratio of the device
no distortion will occur however you must make sure your application works on different
aspect ratios

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1504
UNKNOWN

Unknow policy

meta description
类型 Number
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1515

方法

constructor
meta description
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1388
参数列表
preApply

Manipulation before applying the resolution policy

meta description
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1407
参数列表
  • view View The target view
apply

Function to apply this resolution policy The return value is {scale: [scaleX, scaleY], viewport: {cc.Rect}}, The target view can then apply these value to itself, it's preferred not to modify directly its private variables

meta description
返回 Object
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1417
参数列表
  • view View The target view
  • designedResolution Size The user defined design resolution
postApply

Manipulation after appyling the strategy

meta description
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1431
参数列表
  • view View The target view
setContainerStrategy

Setup the container's scale strategy

meta description
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1441
参数列表
setContentStrategy

Setup the content's scale strategy

meta description
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCView.js:1451
参数列表

results matching ""

    No results matching ""