@antv/g-mobile
Advanced tools
Comparing version 0.0.13 to 0.0.15
@@ -142,8 +142,18 @@ import { __extends } from "tslib"; | ||
Canvas.prototype.setDOMSize = function (width, height) { | ||
_super.prototype.setDOMSize.call(this, width, height); | ||
// 小程序调用会报错 | ||
!this.isMini() && _super.prototype.setDOMSize.call(this, width, height); | ||
var context = this.get('context'); | ||
var pixelRatio = this.getPixelRatio(); | ||
var el = this.get('el'); | ||
var pixelRatio = this.getPixelRatio(); | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
if (this.isMini()) { | ||
el = this.get('container'); | ||
// mini-native 必须传入container | ||
if (this.isMiniNative() && !el) { | ||
console.warn('changeSize失败,缺少container'); | ||
} | ||
} | ||
if (el) { | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
} | ||
// 设置 canvas 元素的宽度和高度,会重置缩放,因此 context.scale 需要在每次设置宽、高后调用 | ||
@@ -150,0 +160,0 @@ if (pixelRatio > 1) { |
@@ -23,3 +23,4 @@ import ShapeBase from './base'; | ||
createPath(context: CanvasRenderingContext2D): void; | ||
strokeAndFill(): void; | ||
} | ||
export default ImageShape; |
@@ -133,2 +133,5 @@ import { __assign, __extends } from "tslib"; | ||
}; | ||
ImageShape.prototype.strokeAndFill = function () { | ||
// image 不需要调用调用fill&stroke,因为上一步并没有绘制path, 再调用一次会重复绘制一次上一次结束的绘制 | ||
}; | ||
return ImageShape; | ||
@@ -135,0 +138,0 @@ }(ShapeBase)); |
@@ -144,8 +144,18 @@ "use strict"; | ||
Canvas.prototype.setDOMSize = function (width, height) { | ||
_super.prototype.setDOMSize.call(this, width, height); | ||
// 小程序调用会报错 | ||
!this.isMini() && _super.prototype.setDOMSize.call(this, width, height); | ||
var context = this.get('context'); | ||
var pixelRatio = this.getPixelRatio(); | ||
var el = this.get('el'); | ||
var pixelRatio = this.getPixelRatio(); | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
if (this.isMini()) { | ||
el = this.get('container'); | ||
// mini-native 必须传入container | ||
if (this.isMiniNative() && !el) { | ||
console.warn('changeSize失败,缺少container'); | ||
} | ||
} | ||
if (el) { | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
} | ||
// 设置 canvas 元素的宽度和高度,会重置缩放,因此 context.scale 需要在每次设置宽、高后调用 | ||
@@ -152,0 +162,0 @@ if (pixelRatio > 1) { |
@@ -23,3 +23,4 @@ import ShapeBase from './base'; | ||
createPath(context: CanvasRenderingContext2D): void; | ||
strokeAndFill(): void; | ||
} | ||
export default ImageShape; |
@@ -137,2 +137,5 @@ "use strict"; | ||
}; | ||
ImageShape.prototype.strokeAndFill = function () { | ||
// image 不需要调用调用fill&stroke,因为上一步并没有绘制path, 再调用一次会重复绘制一次上一次结束的绘制 | ||
}; | ||
return ImageShape; | ||
@@ -139,0 +142,0 @@ }(base_1.default)); |
{ | ||
"name": "@antv/g-mobile", | ||
"version": "0.0.13", | ||
"version": "0.0.15", | ||
"description": "A mobile canvas library which providing 2d", | ||
@@ -9,3 +9,11 @@ "main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": ["src", "package.json", "esm", "lib", "dist", "LICENSE", "README.md"], | ||
"files": [ | ||
"src", | ||
"package.json", | ||
"esm", | ||
"lib", | ||
"dist", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"scripts": { | ||
@@ -30,3 +38,7 @@ "build": "npm run clean && run-p build:*", | ||
}, | ||
"keywords": ["util", "antv", "g"], | ||
"keywords": [ | ||
"util", | ||
"antv", | ||
"g" | ||
], | ||
"author": "https://github.com/orgs/antvis/people", | ||
@@ -50,3 +62,3 @@ "license": "ISC", | ||
"dependencies": { | ||
"@antv/g-base": "^0.5.9", | ||
"@antv/g-base": "^0.5.10", | ||
"@antv/g-math": "^0.1.6", | ||
@@ -53,0 +65,0 @@ "@antv/matrix-util": "^3.1.0-beta.1", |
@@ -157,8 +157,18 @@ import { AbstractCanvas, CanvasCfg, Point } from '@antv/g-base'; | ||
setDOMSize(width: number, height: number) { | ||
super.setDOMSize(width, height); | ||
// 小程序调用会报错 | ||
!this.isMini() && super.setDOMSize(width, height); | ||
const context = this.get('context'); | ||
const el = this.get('el'); | ||
const pixelRatio = this.getPixelRatio(); | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
let el = this.get('el'); | ||
if (this.isMini()) { | ||
el = this.get('container'); | ||
// mini-native 必须传入container | ||
if (this.isMiniNative() && !el) { | ||
console.warn('changeSize失败,缺少container'); | ||
} | ||
} | ||
if (el) { | ||
el.width = pixelRatio * width; | ||
el.height = pixelRatio * height; | ||
} | ||
// 设置 canvas 元素的宽度和高度,会重置缩放,因此 context.scale 需要在每次设置宽、高后调用 | ||
@@ -165,0 +175,0 @@ if (pixelRatio > 1) { |
@@ -145,4 +145,8 @@ import ShapeBase from './base'; | ||
} | ||
strokeAndFill() { | ||
// image 不需要调用调用fill&stroke,因为上一步并没有绘制path, 再调用一次会重复绘制一次上一次结束的绘制 | ||
} | ||
} | ||
export default ImageShape; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1944495
13231
Updated@antv/g-base@^0.5.10