提交 df36df42 编写于 作者: H Hao-Wu

Version 20161010

上级 b5a87585
...@@ -13,11 +13,24 @@ Page({ ...@@ -13,11 +13,24 @@ Page({
methods.forEach(function (method) { methods.forEach(function (method) {
that[method] = function () { that[method] = function () {
example[method](that.context) example[method](that.context)
var actions = that.context.getActions()
wx.drawCanvas({ wx.drawCanvas({
canvasId: 'canvas', canvasId: 'canvas',
actions: that.context.getActions() actions: actions
}) })
} }
}) })
},
toTempFilePath: function () {
wx.toTempFilePath({
canvasId: 'canvas',
success: function (res) {
console.log(res)
},
fail: function (res) {
console.log(res)
}
})
} }
}) })
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<block wx:for="{{methods}}" wx:for-item="method"> <block wx:for="{{methods}}" wx:for-item="method">
<button class="canvas-button" bindtap="{{method}}">{{method}}</button> <button class="canvas-button" bindtap="{{method}}">{{method}}</button>
</block> </block>
<button class="canvas-button" bindtap="toTempFilePath" type="primary">toTempFilePath</button>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
} }
.canvas-element { .canvas-element {
width: 100%; width: 100%;
height: 250px; height: 400rpx;
} }
.canvas-buttons { .canvas-buttons {
padding: 50rpx 50rpx 10rpx; padding: 50rpx 50rpx 10rpx;
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
box-sizing: border-box; box-sizing: border-box;
} }
.canvas-button { .canvas-button {
font-size: 28rpx;
width: 290rpx; width: 290rpx;
margin: 20rpx auto; margin: 20rpx auto;
} }
......
...@@ -214,6 +214,16 @@ example.setStrokeStyle = function (context) { ...@@ -214,6 +214,16 @@ example.setStrokeStyle = function (context) {
}); });
}; };
example.setGlobalAlpha = function (context) {
context.setFillStyle('#000000');
[1, 0.5, 0.1].forEach(function (item, index) {
context.setGlobalAlpha(item)
context.beginPath();
context.rect(0 + 75*index, 0, 50, 50);
context.fill();
});
}
example.setShadow = function (context) { example.setShadow = function (context) {
context.beginPath(); context.beginPath();
context.setShadow(10, 10, 10, 'rgba(0, 0, 0, 199)'); context.setShadow(10, 10, 10, 'rgba(0, 0, 0, 199)');
......
...@@ -3,13 +3,13 @@ var sizeType = [ ['compressed'], ['original'], ['compressed', 'original'] ] ...@@ -3,13 +3,13 @@ var sizeType = [ ['compressed'], ['original'], ['compressed', 'original'] ]
Page({ Page({
data: { data: {
sourceTypeIndex: 0, sourceTypeIndex: 2,
sourceType: ['拍照', '相册', '拍照或相册'], sourceType: ['拍照', '相册', '拍照或相册'],
sizeTypeIndex: 0, sizeTypeIndex: 2,
sizeType: ['压缩', '原图', '压缩或原图'], sizeType: ['压缩', '原图', '压缩或原图'],
countIndex: 0, countIndex: 8,
count: [1, 2, 3, 4, 5, 6, 7, 8, 9] count: [1, 2, 3, 4, 5, 6, 7, 8, 9]
}, },
sourceTypeChange: function (e) { sourceTypeChange: function (e) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view class="page__bd"> <view class="page__bd">
<view class="section section_gap" style="text-align: center;"> <view class="section section_gap" style="text-align: center;">
<audio src="{{current.src}}" poster="{{current.poster}}" name="{{current.name}}" author="{{current.author}}" action="{{audioAction}}" bindplay="audioPlayed" bindtimeupdate="audioTimeUpdated" controls></audio> <audio src="{{current.src}}" poster="{{current.poster}}" name="{{current.name}}" author="{{current.author}}" action="{{audioAction}}" controls></audio>
</view> </view>
</view> </view>
</view> </view>
...@@ -10,11 +10,11 @@ Page({ ...@@ -10,11 +10,11 @@ Page({
covers: [{ covers: [{
latitude: 23.099994, latitude: 23.099994,
longitude: 113.344520, longitude: 113.344520,
iconPath: 'image/green_tri.png', // 目前有 bug,正确的写法应该是 /image/green_tri.png ,等我们下个版本修复吧T_T iconPath: '/image/green_tri.png', // 目前有 bug,正确的写法应该是 /image/green_tri.png ,等我们下个版本修复吧T_T
}, { }, {
latitude: 23.099994, latitude: 23.099994,
longitude: 113.304520, longitude: 113.304520,
iconPath: 'image/green_tri.png', iconPath: '/image/green_tri.png',
rotate: 180 rotate: 180
}] }]
} }
......
var initText = 'this is first line\nthis is second line'
Page({ Page({
data: { data: {
initData: 'this is first line\nthis is second line', text: initText
text: 'this is first line\nthis is second line',
extraLine: []
}, },
extraLine: [],
add: function(e) { add: function(e) {
this.data.extraLine.push('other line') this.extraLine.push('other line')
this.setData({ this.setData({
text: this.data.initData + '\n' + this.data.extraLine.join('\n') text: initText + '\n' + this.extraLine.join('\n')
}) })
}, },
remove: function(e) { remove: function(e) {
if (this.data.extraLine.length > 0) { if (this.extraLine.length > 0) {
this.data.extraLine.pop() this.extraLine.pop()
this.setData({ this.setData({
text: this.data.initData + '\n' + this.data.extraLine.join('\n') text: initText + '\n' + this.extraLine.join('\n')
}) })
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册