Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize recenter #3204

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/locationchooser.html → examples/recenter.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html ng-app='app'>
<head>
<title>Location chooser example</title>
<title>Recenter example</title>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1.0, user-scalable=no, width=device-width">
Expand All @@ -16,7 +16,7 @@
</head>
<body ng-controller="MainController as ctrl">
<div id="map" ngeo-map="ctrl.map"></div>
<p id="desc">This example shows how to use the <code><a href="../apidoc/ngeo.recenterDirective.html" title="Read our documentation">ngeo-recenter</a></code> directive to jump between some predefined areas.</p>
<p id="desc">This example shows how to use the <code><a href="../apidoc/ngeo.recenter.directive.html" title="Read our documentation">ngeo-recenter</a></code> directive to jump between some predefined areas.</p>

<span>Move to:</span>
<select ngeo-recenter ngeo-recenter-map="::ctrl.map">
Expand All @@ -37,7 +37,7 @@
<script src="../node_modules/angular-float-thead/angular-floatThead.js"></script>
<script src="../node_modules/floatthead/dist/jquery.floatThead.min.js"></script>
<script src="../node_modules/proj4/dist/proj4.js"></script>
<script src="/@?main=locationchooser.js"></script>
<script src="/@?main=recenter.js"></script>
<script src="default.js"></script>
<script src="../utils/watchwatchers.js"></script>
</body>
Expand Down
4 changes: 1 addition & 3 deletions examples/locationchooser.js → examples/recenter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
goog.provide('app.locationchooser');
goog.provide('app.recenter');

/** @suppress {extraRequire} */
goog.require('ngeo.recenterDirective');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
Expand Down
4 changes: 3 additions & 1 deletion src/map/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ goog.provide('ngeo.map.module');

goog.require('ngeo');
goog.require('ngeo.map.directive');
goog.require('ngeo.map.recenter');

/**
* @type {!angular.Module}
*/
ngeo.map.module = angular.module('ngeoMapModule', [
ngeo.module.name, // Change me when all dependencies are in a module.
ngeo.map.directive.name
ngeo.map.directive.name,
ngeo.map.recenter.name
]);
16 changes: 12 additions & 4 deletions src/directives/recenter.js → src/map/recenter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
goog.provide('ngeo.recenterDirective');
goog.provide('ngeo.map.recenter');

goog.require('ngeo');

/**
* @type {!angular.Module}
*/
ngeo.map.recenter = angular.module('ngeoRecenter', []);

ngeo.module.requires.push(ngeo.map.recenter.name);

/**
* Provides the "ngeoRecenter" directive, a widget for recentering a map
Expand All @@ -23,14 +29,14 @@ goog.require('ngeo');
* <option ngeo-extent="[727681, 5784754, 1094579, 6029353]">B</option>
* </select>
*
* See our live example: [../examples/locationchooser.html](../examples/locationchooser.html)
* See our live example: [../examples/recenter.html](../examples/recenter.html)
*
* @htmlAttribute {ol.Map} ngeo-recenter-map The map.
* @return {angular.Directive} Directive Definition Object.
* @ngdoc directive
* @ngname ngeoRecenter
*/
ngeo.recenterDirective = function() {
ngeo.map.recenter.directive_ = function() {
return {
restrict: 'A',
link: ($scope, $element, $attrs) => {
Expand Down Expand Up @@ -63,4 +69,6 @@ ngeo.recenterDirective = function() {
}
};
};
ngeo.module.directive('ngeoRecenter', ngeo.recenterDirective);

// Register the directive in the module
ngeo.map.recenter.directive('ngeoRecenter', ngeo.map.recenter.directive_);