Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #17 from MapOnline/develop
Browse files Browse the repository at this point in the history
2.0.5-1
  • Loading branch information
Kevin Richter authored Jul 22, 2016
2 parents 91701a8 + bb5a0c4 commit ae58639
Show file tree
Hide file tree
Showing 31 changed files with 745 additions and 642 deletions.
15 changes: 15 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contribute to Maps4News Interactive

#### Please use English for all communications.
Issues in any language other than Engish will be ignored.

## Issues

- Please keep the title as short as possible.
- Try to explain your issue in as much detail as possible.
- If possible try to add an image of your developer console.

## Pull Requests

- Pull requests should be made towards the develop branch.
- Please don't send pull requests just because you want feature x, a lot of customizability is possible via the api. [api documentation](../docs.md)
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### What happened?



### What did you expect to happen?



### Steps to reproduce
1.


### Your map code snippet
```html
<!-- Your code snippet from online.maps4news.com below this line -->


```
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
.idea
dist
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions app/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ main.api = {
*/
popup: function(i) {
var popup = main.object.popups.get(i);
if(popup === null) {
throw "Popup " + i + " not found";
}
return popup.getApiObject();
return popup.getApiObject() || null;
},

/**
Expand Down Expand Up @@ -93,14 +90,14 @@ main.api = {
* Zoom in 1 level
*/
in: function() {
this.to(main.object.levels.current + 1);
main.api.zoom.to(main.object.levels.current + 1);
},

/**
* Zoom out 1 level
*/
out: function() {
this.to(main.object.levels.current - 1);
main.api.zoom.to(main.object.levels.current - 1);
}
},

Expand Down Expand Up @@ -154,14 +151,14 @@ main.api = {

/**
* Array of controls to add
* @param {Array|Object} objects
* @param {Array|Object} buttons
*/
add: function(objects) {
if(!Array.isArray(objects)) {
objects = [objects];
add: function(buttons) {
if(!Array.isArray(buttons)) {
buttons = [buttons];
}
var control_container = helpers.createElement('div', 'm4n-custom-control-container');
objects.forEach(function(object) {
buttons.forEach(function(object) {

var isDisabled = false;

Expand Down
1 change: 0 additions & 1 deletion app/js/classes/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Level.prototype.checkLoaded = function() {
Level.prototype.draw = function() {
main.object.popups.hideAll();


main.object.context.save();
main.object.context.setTransform(1, 0, 0, 1, 0, 0);

Expand Down
42 changes: 4 additions & 38 deletions app/js/classes/point.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ var Point = function(point) {
}

this.position = {
left: Math.min.apply(null, this.shape.map(function(item) { return item.x })) - 10,
top: Math.min.apply(null, this.shape.map(function(item) { return item.y })) - 10
left: Math.min.apply(null, this.shape.map(function(item) { return item.x })) - main.hotspotMargin,
top: Math.min.apply(null, this.shape.map(function(item) { return item.y })) - main.hotspotMargin
};
this.size = {
width: Math.max.apply(null, this.shape.map(function(item) { return item.x })) - this.position.left + 10,
height: Math.max.apply(null, this.shape.map(function(item) { return item.y })) - this.position.top + 10
width: Math.max.apply(null, this.shape.map(function(item) { return item.x })) - this.position.left + main.hotspotMargin,
height: Math.max.apply(null, this.shape.map(function(item) { return item.y })) - this.position.top + main.hotspotMargin
};
};

Expand Down Expand Up @@ -49,38 +49,4 @@ Point.prototype.isOn = function(x, y) {
y > this.position.top + main.globals.offset.get().y &&
y < this.position.top + this.size.height + main.globals.offset.get().y
);
};

/**
* Get info about the current position of a point
* @returns {object}
*/
Point.prototype.location = function() {
var object = {
left: this.position.left + main.globals.offset.get().x,
top: this.position.top + main.globals.offset.get().y,
right: -(this.position.left + main.globals.offset.get().x - main.object.canvas.clientWidth + this.size.width),
bottom: -(this.position.top + main.globals.offset.get().y - main.object.canvas.clientHeight + this.size.height)
};

object.location = {
x: (function() {
if(object.left < 5) {
return "left";
} else if(object.right < 5) {
return "right";
}
return "center";
})(),
y: (function() {
if(object.top < 5) {
return "above";
} else if(object.bottom < 5) {
return "beneath";
}
return "center";
})()
};

return object;
};
Loading

0 comments on commit ae58639

Please sign in to comment.