gis-common 1.1.13 → 1.1.14

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.
@@ -128,6 +128,7 @@ __webpack_require__.d(__webpack_exports__, "EventDispatcher", function() { retur
128
128
  __webpack_require__.d(__webpack_exports__, "HashMap", function() { return /* reexport */ core_HashMap; });
129
129
  __webpack_require__.d(__webpack_exports__, "WebSocketClient", function() { return /* reexport */ core_WebSocketClient; });
130
130
  __webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /* reexport */ core_WebStorage; });
131
+ __webpack_require__.d(__webpack_exports__, "DevicePixelRatio", function() { return /* reexport */ core_DevicePixelRatio; });
131
132
 
132
133
  // CONCATENATED MODULE: ./src/utils/AnimateUtils.js
133
134
  /* harmony default export */ var AnimateUtils = ({
@@ -2392,6 +2393,120 @@ var WebStorage_WebStorage = function () {
2392
2393
  }();
2393
2394
 
2394
2395
  /* harmony default export */ var core_WebStorage = (WebStorage_WebStorage);
2396
+ // CONCATENATED MODULE: ./src/core/DevicePixelRatio.js
2397
+ var DevicePixelRatio_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2398
+
2399
+ function DevicePixelRatio_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2400
+
2401
+ var DevicePixelRatio = function () {
2402
+ function DevicePixelRatio() {
2403
+ DevicePixelRatio_classCallCheck(this, DevicePixelRatio);
2404
+ }
2405
+ // this.flag = false;
2406
+
2407
+ // 获取系统类型
2408
+
2409
+
2410
+ DevicePixelRatio_createClass(DevicePixelRatio, [{
2411
+ key: '_getSystem',
2412
+ value: function _getSystem() {
2413
+ // let flag = false;
2414
+ var agent = navigator.userAgent.toLowerCase();
2415
+ // var isMac = /macintosh|mac os x/i.test(navigator.userAgent);
2416
+ // if(isMac) {
2417
+ // return false;
2418
+ // }
2419
+ // 现只针对windows处理,其它系统暂无该情况,如有,继续在此添加
2420
+ if (agent.indexOf('windows') >= 0) {
2421
+ return true;
2422
+ }
2423
+ }
2424
+ // 获取页面缩放比例
2425
+ // _getDevicePixelRatio() {
2426
+ // let t = this;
2427
+ // }
2428
+ // 监听方法兼容写法
2429
+
2430
+ }, {
2431
+ key: '_addHandler',
2432
+ value: function _addHandler(element, type, handler) {
2433
+ if (element.addEventListener) {
2434
+ element.addEventListener(type, handler, false);
2435
+ } else if (element.attachEvent) {
2436
+ element.attachEvent('on' + type, handler);
2437
+ } else {
2438
+ element['on' + type] = handler;
2439
+ }
2440
+ }
2441
+ // 校正浏览器缩放比例
2442
+
2443
+ }, {
2444
+ key: '_correct',
2445
+ value: function _correct() {
2446
+ // 配合px2rem插件进行自适应布局
2447
+ var pageWidth = window.innerWidth;
2448
+ //为了ie也能拿到可视窗口宽度
2449
+ if (typeof pageWidth != 'number') {
2450
+ //标准模式
2451
+ if (document.compatMode == 'CSS1Compat') {
2452
+ pageWidth = document.documentElement.clientWidth;
2453
+ //怪异模式
2454
+ } else {
2455
+ pageWidth = document.body.clientWidth;
2456
+ }
2457
+ }
2458
+ if (pageWidth <= 750) {
2459
+ var baseSize = 75;
2460
+ // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
2461
+ var scale = document.documentElement.clientWidth / pageWidth;
2462
+ // 设置页面根节点字体大小
2463
+ document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px';
2464
+ } else if (pageWidth > 750 && pageWidth <= 1200) {
2465
+ var _baseSize = 85;
2466
+ // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
2467
+ var _scale = document.documentElement.clientWidth / pageWidth;
2468
+ // 设置页面根节点字体大小
2469
+ document.documentElement.style.fontSize = _baseSize * Math.min(_scale, 2) + 'px';
2470
+ } else {
2471
+ var _baseSize2 = 100;
2472
+ // 当前页面宽度相对于 750 宽的缩放比例,可根据自己需要修改。
2473
+ var _scale2 = document.documentElement.clientWidth / 1920;
2474
+ // 设置页面根节点字体大小
2475
+ document.documentElement.style.fontSize = _baseSize2 * Math.min(_scale2, 2) + 'px';
2476
+ }
2477
+ }
2478
+ // 监听页面缩放
2479
+
2480
+ }, {
2481
+ key: '_watch',
2482
+ value: function _watch() {
2483
+ var t = this;
2484
+ t._addHandler(window, 'resize', function () {
2485
+ // 注意这个方法是解决全局有两个window.resize
2486
+ // 重新校正
2487
+ t._correct();
2488
+ });
2489
+ }
2490
+ // 初始化页面比例
2491
+
2492
+ }, {
2493
+ key: 'init',
2494
+ value: function init() {
2495
+ var t = this;
2496
+ if (t._getSystem()) {
2497
+ // 判断设备,目前只在windows系统下校正浏览器缩放比例
2498
+ // 初始化页面校正浏览器缩放比例
2499
+ t._correct();
2500
+ // 开启监听页面缩放
2501
+ t._watch();
2502
+ }
2503
+ }
2504
+ }]);
2505
+
2506
+ return DevicePixelRatio;
2507
+ }();
2508
+
2509
+ /* harmony default export */ var core_DevicePixelRatio = (DevicePixelRatio);
2395
2510
  // CONCATENATED MODULE: ./src/index.js
2396
2511
 
2397
2512
 
@@ -2404,6 +2519,7 @@ var WebStorage_WebStorage = function () {
2404
2519
 
2405
2520
 
2406
2521
 
2522
+
2407
2523
  /***/ })
2408
2524
  /******/ ]);
2409
2525
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "gis-common",
3
3
  "description": "gis-common",
4
4
  "main": "dist/resource.min.js",
5
- "version": "1.1.13",
5
+ "version": "1.1.14",
6
6
  "author": "Guo.Yan <luv02@vip.qq.com>",
7
7
  "license": "MIT",
8
8
  "private": false,