material 0.9.6 → 0.9.7

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.
@@ -1,46 +0,0 @@
1
- export default {
2
-
3
- updatePaths () {
4
- this.path = {}
5
- this.paths = []
6
- const paths = this.paths = this.map.querySelectorAll('path')
7
- this.path = this.path || {}
8
-
9
- for (let i = 0; i < paths.length; i++) {
10
- const path = paths[i]
11
- const rect = path.getBoundingClientRect()
12
- this.path[i] = rect
13
- }
14
- },
15
-
16
- updateViewport () {
17
- console.log('updateViewport', this.rect, this.screen)
18
- const paths = this.paths
19
- for (let i = 0; i < paths.length; i++) {
20
- const path = paths[i]
21
- if (this.viewport(this.path[i])) {
22
- path.classList.remove('hide')
23
- } else {
24
- path.classList.add('hide')
25
- }
26
- }
27
- },
28
-
29
- viewport (rect) {
30
- if (!rect) return
31
-
32
- // *var rect = this.path[path]
33
-
34
- const top = rect.top
35
- const left = rect.left
36
- const width = rect.width
37
- const height = rect.height
38
-
39
- return (
40
- top >= this.screen.y &&
41
- left >= this.screen.x &&
42
- (top + height) <= (this.screen.y + this.screen.height) &&
43
- (left + width) <= (this.screen.x + this.screen.width)
44
- )
45
- }
46
- }
package/src/map.js DELETED
@@ -1,67 +0,0 @@
1
- import mediator from '../module/mediator'
2
- import emitter from 'material/src/module/emitter'
3
- import attach from 'material/src/module/attach'
4
-
5
- import init from './map/init'
6
- import build from './map/build'
7
- import viewport from './map/viewport'
8
- import countries from './map/countries'
9
- import set from './map/set'
10
- import mouse from './map/mouse'
11
- import display from './map/display'
12
- import mode from './map/mode'
13
- import select from './map/select'
14
- import focus from './map/focus'
15
-
16
- // Depracted
17
-
18
- class Map {
19
- static defaults = {
20
- class: 'worldmap',
21
- tag: 'main',
22
- zoom: 0.3,
23
- isocodes: [],
24
- mode: 'unique',
25
- path: '/dist/map/',
26
- pinchZoom: {
27
- maxZoom: 128,
28
- minZoom: 3,
29
- setOffsetsOnce: true,
30
- verticalPadding: 64,
31
- horizontalPadding: 64,
32
- tapZoomFactor: 0
33
- },
34
- events: [
35
- ['root.mousedown', 'mouseDown'],
36
- ['root.mouseup', 'mouseUp'],
37
- ['root.mousemove', 'mouseMove'],
38
- ['root.mouseleave', 'mouseLeave'],
39
- ['root.mouseout', 'mouseOut'],
40
- ['root.click', 'mouseClick'],
41
- ['root.touchStart', 'mouseClick']
42
- ]
43
- }
44
-
45
- constructor (options) {
46
- this.options = { ...Map.defaults, ...options }
47
-
48
- Object.assign(
49
- this, emitter, init, build, viewport, mouse,
50
- mode, countries,
51
- set, display, select, focus
52
- )
53
-
54
- mediator.installTo(this)
55
-
56
- this.init(options)
57
-
58
- this.build()
59
- this.attach(events)
60
-
61
- this.publish('initWorldmap')
62
-
63
- return this
64
- }
65
- }
66
-
67
- export default Map