mirror of
https://github.com/NASAWorldWind/WebWorldWind.git
synced 2025-12-08 19:46:18 +00:00
* Corrected comparison operators with type coercion * Corrected comparison operator with type coercion * Corrected comparison operator with type coercion * Corrected comparison operators with type coercion * First draft of ScreenCreditController composite * Usage of ScreenText and ScreenImage in controller - Temporarily modified OSM layer server for testing purposes * Attempted to render ScreenText and ScreenImage * Corrected proper check of existence of both stringCredits and imageCredits * ImageCredit offset test * ImageCredit offset test (still no proper units implemented) * Image credits correct offset implemented * Removed unneeded attributes and methods related to opacity - Opacity will be handled in the Layer level. No need for the attribute in the class. - Due to the aforementioned, the text attributes won't need a default alpha setting either. - Removed transform matrices since the class is not handling graphics rendering anymore. * First attempt at drawing string credits with proper offset * Screencreditcontroller added as a layer * Fix broken unit tests * Change ScreenCreditController so it will operate as a Layer - Identified which part of TextRenderer is causing the ScreenText not to render. * doRender override in ScreenCreditController so it works as before - Corrected typo in TextRenderer * Solved bug for string credits. - An object was being passed instead of a string - Bug: Offset calculation is still wrong, but text is rendering now - Bug: First ScreenText is rendered without transparency, the second one is half transparent. - Bug: ScreenTexts are rendering with outlines * Rendered all image and string credits in their appropriate offsets - Layer opacity is still not accounted for - Bug: "WorldWindow.drawOrderedRenderables: Error while rendering an ordered renderable. Cannot read property 'opacity' of null" E.g: USGSSlabs is not rendering the slabs. * Set default layer opacity to fully replicate prior behavior - Bug regarding other orderedRenderables opacity still present. * New controller proposal * Obtainint textures with makeOrderedRenderable(). Still getting bugs. * Removed layer opacity and unneeded return statement * Added fixed credit spacing. Reintroduced default layer opacity * Removed previous offsetting code * Temporary modification to WorldWindow to work around bug (issue 494) * Credit display with fixed spacing * Aligning to right text credits without resorting to texture size * Added TextAttributes.offset setting for text credits * Added previously existing exception handling * Simplified loop indexes * Changed credit spacing index placement to increase readability * Added note to document temporary workaround * Reverted change to comparison operators - Will submit these changes in a different branch. * Reverted change to comparison operators - Will submit these changes in a different branch. * Removed currently unused modules. Reintroduced license notice. * Removed now unused property * Renamed index to a more descriptive name * Used faster pattern in iterative loop * First attempt to switch RenderableLayer inheritance to Layer * Added call to render() to every renderable, removed call to Layer.doRender() - Removed all unused modules * Modified whitespace to license as in other modules * Removed unused parameter * Corrected another unneeded iterated call to Array.length - Properly nitialized index in iterator * Verify previously added credit existence to avoid credit repetition * Code formatting corrections
83 lines
3.0 KiB
JavaScript
83 lines
3.0 KiB
JavaScript
/*
|
|
* Copyright 2015-2017 WorldWind Contributors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
define([
|
|
'src/BasicWorldWindowController',
|
|
'src/render/DrawContext',
|
|
'src/globe/EarthElevationModel',
|
|
'src/globe/Globe',
|
|
'src/globe/Globe2D',
|
|
'src/geom/Matrix',
|
|
'src/navigate/LookAtNavigator',
|
|
'src/geom/Rectangle',
|
|
'src/geom/Vec2',
|
|
'src/geom/Vec3',
|
|
'src/WorldWind',
|
|
'src/WorldWindow'
|
|
], function (BasicWorldWindowController, DrawContext, EarthElevationModel, Globe, Globe2D, Matrix, LookAtNavigator, Rectangle, Vec2, Vec3, WorldWind, WorldWindow) {
|
|
"use strict";
|
|
|
|
var MockGlContext = function () {
|
|
this.drawingBufferWidth = 800;
|
|
this.drawingBufferHeight = 800;
|
|
};
|
|
|
|
var viewport = new Rectangle(0, 0, 848, 848);
|
|
var dc = new DrawContext(new MockGlContext());
|
|
var MockWorldWindow = function () {
|
|
};
|
|
|
|
MockWorldWindow.prototype = Object.create(WorldWindow.prototype);
|
|
|
|
var mockGlobe = new Globe2D();
|
|
var wwd = new MockWorldWindow();
|
|
wwd.globe = mockGlobe;
|
|
wwd.drawContext = dc;
|
|
wwd.navigator = new LookAtNavigator(wwd);
|
|
wwd.worldWindowController = new BasicWorldWindowController(wwd);
|
|
wwd.viewport = viewport;
|
|
wwd.depthBits = 24;
|
|
wwd.canvas = {
|
|
clientLeft: 0, clientTop: 0, getBoundingClientRect: function () {
|
|
return {left: 339.5, top: 225};
|
|
}
|
|
};
|
|
wwd.layers = [];
|
|
wwd.scratchModelview = Matrix.fromIdentity();
|
|
wwd.scratchProjection = Matrix.fromIdentity();
|
|
wwd.resetDrawContext();
|
|
|
|
describe("BasicWorldWindowController tests", function () {
|
|
|
|
describe("Calculate 2D drag", function () {
|
|
it("Correctly interprets 2D drag gesture", function () {
|
|
var recognizer = {state: "changed", clientX: 0, clientY: 0, translationX: 0, translationY: 0};
|
|
wwd.worldWindowController.beginPoint = new Vec2(693, 428);
|
|
wwd.worldWindowController.lastPoint = new Vec2(693.4, 429.2);
|
|
wwd.worldWindowController.handlePanOrDrag2D(recognizer);
|
|
|
|
var navigator = wwd.navigator;
|
|
expect(navigator.range).toEqual(10000000);
|
|
expect(navigator.tilt).toEqual(0);
|
|
expect(navigator.roll).toEqual(0);
|
|
expect(navigator.heading).toEqual(0);
|
|
expect(navigator.lookAtLocation.latitude).toBeCloseTo(29.8728799, 7);
|
|
expect(navigator.lookAtLocation.longitude).toBeCloseTo(-109.9576266, 7);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|