@dolphinweex/weex-vue-render 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +63 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -3985,7 +3985,7 @@ function initEnv (viewportInfo, envInfo) {
|
|
|
3985
3985
|
osName: osName,
|
|
3986
3986
|
osVersion: osVersion,
|
|
3987
3987
|
|
|
3988
|
-
deviceModel: device_display.deviceModel ||
|
|
3988
|
+
deviceModel: device_display.deviceModel || "",
|
|
3989
3989
|
appEnv: device_display.appEnv,
|
|
3990
3990
|
versionCode: device_display.versionCode,
|
|
3991
3991
|
idfa: device_display.idfa,
|
|
@@ -6281,6 +6281,67 @@ var scroller = {
|
|
|
6281
6281
|
}
|
|
6282
6282
|
};
|
|
6283
6283
|
|
|
6284
|
+
function getGCanvas (weex) {
|
|
6285
|
+
var extractComponentStyle = weex.extractComponentStyle;
|
|
6286
|
+
var ref = weex.utils;
|
|
6287
|
+
var dispatchNativeEvent = ref.dispatchNativeEvent;
|
|
6288
|
+
|
|
6289
|
+
return {
|
|
6290
|
+
name: 'weex-gcanvas',
|
|
6291
|
+
mounted: function mounted() {
|
|
6292
|
+
var wrapper = this.$refs.gcanvas;
|
|
6293
|
+
var rate = 750 / document.documentElement.clientWidth
|
|
6294
|
+
wrapper.width = wrapper.clientWidth * rate;
|
|
6295
|
+
wrapper.height = wrapper.clientWidth * rate;
|
|
6296
|
+
|
|
6297
|
+
var context = wrapper.getContext(type || '2d')
|
|
6298
|
+
context.scale(rate, rate)
|
|
6299
|
+
},
|
|
6300
|
+
methods:{
|
|
6301
|
+
getContext: function (type) {
|
|
6302
|
+
var wrapper = this.$refs.gcanvas;
|
|
6303
|
+
var context = wrapper.getContext(type || '2d')
|
|
6304
|
+
return context
|
|
6305
|
+
},
|
|
6306
|
+
|
|
6307
|
+
getContextAsyn: function (type, callback) {
|
|
6308
|
+
var wrapper = this.$refs.gcanvas;
|
|
6309
|
+
var context = wrapper.getContext(type || '2d')
|
|
6310
|
+
callback(context)
|
|
6311
|
+
},
|
|
6312
|
+
|
|
6313
|
+
drawImage: function (url) {
|
|
6314
|
+
var wrapper = this.$refs.gcanvas;
|
|
6315
|
+
var context = wrapper.getContext(type || '2d')
|
|
6316
|
+
|
|
6317
|
+
var img = new Image();
|
|
6318
|
+
img.src = url
|
|
6319
|
+
arguments[0] = img
|
|
6320
|
+
return context.drawImage.apply(context, arguments)
|
|
6321
|
+
}
|
|
6322
|
+
},
|
|
6323
|
+
render: function render (createElement) {
|
|
6324
|
+
var attrs = this.$vnode.data.attrs;
|
|
6325
|
+
return createElement('canvas', {
|
|
6326
|
+
attrs: {
|
|
6327
|
+
'weex-type': 'gcanvas'
|
|
6328
|
+
},
|
|
6329
|
+
ref: 'gcanvas',
|
|
6330
|
+
staticClass: 'weex-gcanvas weex-ct',
|
|
6331
|
+
staticStyle: extractComponentStyle(this)
|
|
6332
|
+
})
|
|
6333
|
+
}
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
|
|
6337
|
+
var gcanvas = {
|
|
6338
|
+
init: function (Weex) {
|
|
6339
|
+
Weex.registerComponent('gcanvas', getGCanvas(Weex))
|
|
6340
|
+
}
|
|
6341
|
+
};
|
|
6342
|
+
|
|
6343
|
+
|
|
6344
|
+
|
|
6284
6345
|
/*
|
|
6285
6346
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
6286
6347
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -7236,6 +7297,7 @@ var modules = [
|
|
|
7236
7297
|
waterfall,
|
|
7237
7298
|
// cell,
|
|
7238
7299
|
header,
|
|
7300
|
+
gcanvas,
|
|
7239
7301
|
loading,
|
|
7240
7302
|
refresh,
|
|
7241
7303
|
loadingIndicator$1,
|
package/package.json
CHANGED