Commit d242bd32 by 张立顺

冲突解决

1 parent a04de189
...@@ -38,14 +38,7 @@ class Draw { ...@@ -38,14 +38,7 @@ class Draw {
async drawImages(imageParams, callback) { async drawImages(imageParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
this[_ctx_].save() this[_ctx_].save()
let { let { borderRadius, height, width, url, x, y } = imageParams
borderRadius,
height,
width,
url,
x,
y
} = imageParams
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -87,13 +80,7 @@ class Draw { ...@@ -87,13 +80,7 @@ class Draw {
return this[_ctx_].measureText(text).width return this[_ctx_].measureText(text).width
} }
// 画块形状 // 画块形状
drawFill({ drawFill({ x, y, width, height, color }) {
x,
y,
width,
height,
color
}) {
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -106,24 +93,7 @@ class Draw { ...@@ -106,24 +93,7 @@ class Draw {
this[_ctx_].save() this[_ctx_].save()
} }
drawText(textParams) { drawText(textParams) {
let { let { textDecoration, textBaseline, lineHeight, fontWeight, textAlign, textWidth, maxWidth, fontSize, lastFont, opacity, lineNum, width, color, text, x, y } = textParams,
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
lastFont,
opacity,
lineNum,
width,
color,
text,
x,
y
} = textParams,
font = this[_ctx_].font.split('px')[1] font = this[_ctx_].font.split('px')[1]
textAlign = textAlign || 'left' textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal' textBaseline = textBaseline || 'normal'
...@@ -237,17 +207,7 @@ class Draw { ...@@ -237,17 +207,7 @@ class Draw {
this[_ctx_].stroke() this[_ctx_].stroke()
} }
drawBorder(params) { drawBorder(params) {
let { let { x, y, text, color, width, radius, opacity, padding, fontSize } = params,
x,
y,
text,
color,
width,
radius,
opacity,
padding,
fontSize
} = params,
paddingX = 0, paddingX = 0,
paddingY = 0 paddingY = 0
if (padding && padding.length) { if (padding && padding.length) {
...@@ -259,7 +219,8 @@ class Draw { ...@@ -259,7 +219,8 @@ class Draw {
endX = this.toRpx(x) + this.getTextWidth(text) + paddingX, endX = this.toRpx(x) + this.getTextWidth(text) + paddingX,
startY = this.toRpx(y) - paddingY, startY = this.toRpx(y) - paddingY,
endY = this.toRpx(y + fontSize) + paddingY / 2, endY = this.toRpx(y + fontSize) + paddingY / 2,
arr = [{ arr = [
{
x: startX, x: startX,
y: startY, y: startY,
width: endX width: endX
...@@ -286,7 +247,8 @@ class Draw { ...@@ -286,7 +247,8 @@ class Draw {
this[_ctx_].lineWidth = width || this.toRpx(1) this[_ctx_].lineWidth = width || this.toRpx(1)
if (radius) { if (radius) {
radius = this.toRpx(radius) radius = this.toRpx(radius)
let arcArr = [{ let arcArr = [
{
moveTo: [startX, startY + radius], moveTo: [startX, startY + radius],
arcTo: [startX, startY, startX + radius, startY] arcTo: [startX, startY, startX + radius, startY]
}, },
...@@ -331,16 +293,7 @@ class Draw { ...@@ -331,16 +293,7 @@ class Draw {
} }
drawLine(lineParams, callback) { drawLine(lineParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
let { let { noTransition, opacity, startX, startY, width, color, endX, endY } = lineParams
noTransition,
opacity,
startX,
startY,
width,
color,
endX,
endY
} = lineParams
if (!noTransition) { if (!noTransition) {
startX = this.toRpx(startX) startX = this.toRpx(startX)
startY = this.toRpx(startY) startY = this.toRpx(startY)
...@@ -359,12 +312,7 @@ class Draw { ...@@ -359,12 +312,7 @@ class Draw {
if (callback) callback() if (callback) callback()
} }
setLineY = params => { setLineY = params => {
let { let { textDecoration, textBaseline, fontSize, y } = params
textDecoration,
textBaseline,
fontSize,
y
} = params
let type = { let type = {
underline: { underline: {
top: y + fontSize, top: y + fontSize,
...@@ -387,11 +335,7 @@ class Draw { ...@@ -387,11 +335,7 @@ class Draw {
} }
return type[textDecoration][textBaseline] return type[textDecoration][textBaseline]
} }
setLineX({ setLineX({ textAlign, text, x }) {
textAlign,
text,
x
}) {
let textWidth = this.getTextWidth(text) let textWidth = this.getTextWidth(text)
let type = { let type = {
left: x, left: x,
...@@ -400,13 +344,7 @@ class Draw { ...@@ -400,13 +344,7 @@ class Draw {
} }
return type[textAlign] return type[textAlign]
} }
drawRadiusRect({ drawRadiusRect({ borderRadius, height, width, x, y }, callBack) {
borderRadius,
height,
width,
x,
y
}, callBack) {
let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2 let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2
radius = radius || 0 radius = radius || 0
this[_ctx_].beginPath() this[_ctx_].beginPath()
...@@ -417,12 +355,7 @@ class Draw { ...@@ -417,12 +355,7 @@ class Draw {
} }
if (callBack) callBack() if (callBack) callBack()
} }
getFontWidth({ getFontWidth({ textAlign, fontSize, text, x }) {
textAlign,
fontSize,
text,
x
}) {
let type = { let type = {
left: x, left: x,
center: x - (fontSize * text.length) / 2, center: x - (fontSize * text.length) / 2,
...@@ -432,12 +365,7 @@ class Draw { ...@@ -432,12 +365,7 @@ class Draw {
} }
drawDecoration(params) { drawDecoration(params) {
let { let { newText, opacity, y, x } = params
newText,
opacity,
y,
x
} = params
let lineX = x let lineX = x
let lineY = y let lineY = y
lineX = this.setLineX(params) lineX = this.setLineX(params)
...@@ -509,14 +437,7 @@ const checkTextDecoration = textDecoration => { ...@@ -509,14 +437,7 @@ const checkTextDecoration = textDecoration => {
} }
/**网络图片转成本地资源 */ /**网络图片转成本地资源 */
<<<<<<< HEAD
const createLocalImg = ({
filePath,
fileId
}, callBack) => {
=======
const createLocalImg = ({ filePath, fileId }, callBack) => { const createLocalImg = ({ filePath, fileId }, callBack) => {
>>>>>>> dev_v3.1
wx.getImageInfo({ wx.getImageInfo({
src: filePath, src: filePath,
success(res) { success(res) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!