fix ccview resize

This commit is contained in:
jerrywwl
2019-04-03 11:16:20 +08:00
parent ddc377bfb0
commit 94a930f7fc
3 changed files with 10 additions and 6 deletions
+5 -2
View File
@@ -698,12 +698,15 @@ class Game extends EventTarget {
this._gfxDevice = new cc.WebGLGFXDevice();
}
const nativeWidth = parseInt(screen.width * window.devicePixelRatio);
const nativeHeight = parseInt(screen.height * window.devicePixelRatio);
this._gfxDevice.initialize({
canvasElm: localCanvas,
debug: true,
devicePixelRatio: window.devicePixelRatio,
nativeWidth: screen.width * window.devicePixelRatio,
nativeHeight: screen.height * window.devicePixelRatio,
nativeWidth,
nativeHeight,
});
}
+3 -2
View File
@@ -219,8 +219,6 @@ class View extends EventTarget {
if (width > 0)
view.setDesignResolutionSize(width, height, view._resolutionPolicy);
// cc.director.root.resize(cc.winSize.width, cc.winSize.height);
view._resizing = false;
view.emit('canvas-resize');
@@ -559,6 +557,9 @@ class View extends EventTarget {
// canvas.width = width * this._devicePixelRatio;
// canvas.height = height * this._devicePixelRatio;
canvas.width = width;
canvas.height = height;
canvas.style.width = width + 'px';
canvas.style.height = height + 'px';
+2 -2
View File
@@ -218,7 +218,7 @@ export abstract class RenderPipeline {
if (width * this._shadingScale > this._shadingWidth ||
height * this._shadingScale > this._shadingHeight) {
this._shadingScale = Math.min(this._shadingWidth / width, this._shadingHeight / height);
console.info('SHADING_SCALE: ' + this._shadingScale);
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(4));
}
for (const flow of this._flows) {
@@ -365,7 +365,7 @@ export abstract class RenderPipeline {
console.info('USE_SMAA: ' + this._useSMAA);
console.info('CC_USE_HDR: ' + this._isHDR);
console.info('SHADING_SIZE: ' + this._shadingWidth + ' x ' + this._shadingHeight);
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(2));
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(4));
console.info('SHADING_COLOR_FORMAT: ' + GFXFormatInfos[this._colorFmt].name);
console.info('SHADING_DEPTH_FORMAT: ' + GFXFormatInfos[this._depthStencilFmt].name);