Commit 208b6e22 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '702-plugin-functionalities' into 'master'

current zoom level is used when no zoom level is provided

Closes #702

See merge request !691
parents c1728d5a 2bad4775
Pipeline #9165 passed with stage
in 8 minutes and 56 seconds
...@@ -65,7 +65,7 @@ var Promise = require("bluebird"); ...@@ -65,7 +65,7 @@ var Promise = require("bluebird");
* @property {(function({modelId: number, zoom: number}): Promise|PromiseLike)} setZoom * @property {(function({modelId: number, zoom: number}): Promise|PromiseLike)} setZoom
* @property {(function(*): number)} getZoom * @property {(function(*): number)} getZoom
* @property {(function(*): PromiseLike)} openMap * @property {(function(*): PromiseLike)} openMap
* @property {function({dbOverlayName: string, [query]:string, [perfect]: boolean, [fitBounds]:boolean, [coordinates]:Point}): Promise|PromiseLike} triggerSearch * @property {function({dbOverlayName: string, [query]:string, [perfect]: boolean, [fitBounds]:boolean, [coordinates]:Point, [zoom]:number}, [modelId]:number): Promise|PromiseLike} triggerSearch
* @property {function(): Promise|PromiseLike} clear * @property {function(): Promise|PromiseLike} clear
*/ */
...@@ -452,11 +452,15 @@ function createProjectMap(options) { ...@@ -452,11 +452,15 @@ function createProjectMap(options) {
if (params.query !== undefined) { if (params.query !== undefined) {
return dbOverlay.searchByQuery(params.query, params.perfect, params.fitBounds); return dbOverlay.searchByQuery(params.query, params.perfect, params.fitBounds);
} else if (dbOverlay instanceof SearchDbOverlay) { } else if (dbOverlay instanceof SearchDbOverlay) {
var zoom = params.zoom;
if (zoom ===undefined) {
zoom = map.getSubmapById(params.modelId).getZoom();
}
return dbOverlay.searchByCoordinates({ return dbOverlay.searchByCoordinates({
coordinates: params.coordinates, coordinates: new Point(params.coordinates),
modelId: params.modelId, modelId: params.modelId,
fitBounds: params.fitBounds, fitBounds: params.fitBounds,
zoom: params.zoom zoom: zoom
}); });
} else { } else {
return Promise.reject(new Error("Don't know how to handle your query")); return Promise.reject(new Error("Don't know how to handle your query"));
......
...@@ -977,6 +977,34 @@ describe('MinervaPluginProxy', function () { ...@@ -977,6 +977,34 @@ describe('MinervaPluginProxy', function () {
return map.destroy(); return map.destroy();
}); });
}); });
it('coordinates without zoom', function () {
var callbackOk = false;
var map;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
helper.createSearchDbOverlay(map);
var proxy = createProxy(map);
proxy.project.map.addListener({
dbOverlayName: "search",
type: "onSearch",
callback: function (elements) {
assert.ok(elements.length > 0);
assert.ok(elements[0].length > 0);
callbackOk = true;
}
});
return proxy.project.map.triggerSearch({
coordinates: new Point(316.05, 253.61),
modelId: map.getModel().getId(),
dbOverlayName: "search"
});
}).then(function () {
assert.ok(callbackOk);
assert.equal(0, logger.getWarnings().length);
return map.destroy();
});
});
}); });
describe('drug', function () { describe('drug', function () {
it('query search', function () { it('query search', function () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment