From 54eb5672a5f43fb157aa7ecb88b0ba8a06296b86 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sun, 18 Mar 2012 22:25:35 -0700 Subject: using channel name rather than url --- node_modules/components-data/youtube-channel.json | 2 +- .../montage/examples/youtube-channel-example/index.html | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'node_modules') diff --git a/node_modules/components-data/youtube-channel.json b/node_modules/components-data/youtube-channel.json index 8affffba..c909fd1b 100644 --- a/node_modules/components-data/youtube-channel.json +++ b/node_modules/components-data/youtube-channel.json @@ -7,7 +7,7 @@ "properties": [ { - "name": "channelUrl", + "name": "channel", "type": "string", "default": "" } diff --git a/node_modules/montage/examples/youtube-channel-example/index.html b/node_modules/montage/examples/youtube-channel-example/index.html index b313d5d8..f3a0592a 100755 --- a/node_modules/montage/examples/youtube-channel-example/index.html +++ b/node_modules/montage/examples/youtube-channel-example/index.html @@ -14,7 +14,8 @@ "player": { "prototype": "montage/ui/youtube-channel.reel", "properties": { - "element": {"#": "player"} + "element": {"#": "player"}, + "channel": "drive" } }, @@ -23,12 +24,6 @@ "properties": { "element": {"#": "url"}, "value": "http://www.youtube.com/TEDEducation" - }, - "bindings": { - "value": { - "boundObject": {"@": "player"}, - "boundObjectPropertyPath": "channelUrl" - } } } } @@ -37,7 +32,7 @@
Youtube Channel
- +
-- cgit v1.2.3 From 222562c734396403c18c90a1ca395a36c4d49da4 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Mon, 19 Mar 2012 09:21:15 -0700 Subject: Youtube appending script in draw --- .../ui/youtube-channel.reel/youtube-channel.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'node_modules') diff --git a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js index fd642290..3e20c406 100644 --- a/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js +++ b/node_modules/montage/ui/youtube-channel.reel/youtube-channel.js @@ -77,9 +77,22 @@ var YoutubeChannel = exports.YoutubeChannel = Montage.create(Component, { // create url var url = "http://gdata.youtube.com/feeds/api/users/" + this._channel + "/uploads?v=2&alt=json-in-script&callback=" + callbackName; - var script = document.createElement("script"); - script.src = url; - this._element.appendChild(script); + this.script = document.createElement("script"); + this.script.src = url; + this.needsDraw = true; + } + }, + + script: { + value: null + }, + + draw: { + value: function() { + if (this.script) { + this._element.appendChild(this.script); + this.script = null; + } } }, -- cgit v1.2.3 From eb5cda3ce03b35c3335b91c34ead0cdf290b243e Mon Sep 17 00:00:00 2001 From: Stuart Knightley Date: Mon, 19 Mar 2012 09:46:38 -0700 Subject: Update Youtube player to HTML5 --- .../ui/youtube-player.reel/youtube-player.html | 10 ++---- .../ui/youtube-player.reel/youtube-player.js | 38 ++++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'node_modules') diff --git a/node_modules/montage/ui/youtube-player.reel/youtube-player.html b/node_modules/montage/ui/youtube-player.reel/youtube-player.html index ae757626..ec61493c 100644 --- a/node_modules/montage/ui/youtube-player.reel/youtube-player.html +++ b/node_modules/montage/ui/youtube-player.reel/youtube-player.html @@ -7,23 +7,19 @@ + -
- - - -
+ ​ diff --git a/node_modules/montage/ui/youtube-player.reel/youtube-player.js b/node_modules/montage/ui/youtube-player.reel/youtube-player.js index 2f7709d7..462dca58 100644 --- a/node_modules/montage/ui/youtube-player.reel/youtube-player.js +++ b/node_modules/montage/ui/youtube-player.reel/youtube-player.js @@ -1,10 +1,9 @@ -//data="https://www.youtube.com/v/u1zgFlCw8Aw?version=3&enablejsapi=1&playerapiid=ytplayer" /* This file contains proprietary software owned by Motorola Mobility, Inc.
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/ -/*global require,exports*/ +/*global require,exports,YT */ var Montage = require("montage").Montage, Component = require("ui/component").Component; @@ -31,7 +30,6 @@ var YoutubePlayer = exports.YoutubePlayer = Montage.create(Component, { return this._player; }, set: function(value) { - // TODO don't allow this to be changed if (this._player !== value) { this._player = value; } @@ -127,30 +125,36 @@ var YoutubePlayer = exports.YoutubePlayer = Montage.create(Component, { value: function() { // Create the callback if it doesn't exist, and make it dispatch // an event on the document instead - if (!window.onYouTubePlayerReady) { - window.onYouTubePlayerReady = function(playerId) { + if (!window.onYouTubePlayerAPIReady) { + window.onYouTubePlayerAPIReady = function() { var event = document.createEvent("CustomEvent"); - event.initEvent("youtubePlayerReady", true, true); - event.playerId = playerId; + event.initEvent("youtubePlayerApiReady", true, true); document.dispatchEvent(event); }; } - document.addEventListener("youtubePlayerReady", this, false); + this._element.src += (this._videoId ? "/" + this._videoId : "") + "?enablejsapi=1"; - // If there's no videoId set one the doesn't exist - this._player.data = "https://www.youtube.com/v/" + (this._videoId || "xxxxxxxxxxx") + "?version=3&enablejsapi=1&playerapiid=" + this.uuid; + if (typeof YT !== "undefined" && YT.Player) { + this.handleYoutubePlayerApiReady(); + } else { + document.addEventListener("youtubePlayerApiReady", this, false); + } } }, - handleYoutubePlayerReady: { + handleYoutubePlayerApiReady: { value: function(event) { - if (event.playerId !== this.uuid) { - return; - } - - this._ready = true; - this.needsDraw = true; + console.log("handleYoutubePlayerApiReady"); + document.removeEventListener("youtubePlayerApiReady", this); + + var self = this; + this.player = new YT.Player(this._element, { events: { + onReady: function(event) { + self._ready = true; + self.needsDraw = true; + } + }}); } }, -- cgit v1.2.3 From 9d364be255900e9bde02c4b254d145ec41fc78fb Mon Sep 17 00:00:00 2001 From: Kishore Subramanian Date: Mon, 19 Mar 2012 10:36:49 -0700 Subject: Changes to the Demo - Feed Reader now shows one entry at a time - Category dropdown removed form the Map. It is included as part of the example code - Changed the categories that do not return results --- .../examples/feed-reader/images/47-fuel.png | Bin 0 -> 3091 bytes .../feed-reader/images/80-shopping-cart.png | Bin 0 -> 2963 bytes .../examples/feed-reader/images/88-beer-mug.png | Bin 0 -> 3087 bytes .../examples/feed-reader/main.reel/main.html | 26 +++++++++++ .../montage/examples/feed-reader/main.reel/main.js | 10 ++++ .../ui/feed-reader/feed-entry.reel/feed-entry.html | 1 - .../feed-reader/feed-reader.reel/feed-reader.html | 26 +++++++++-- .../ui/feed-reader/feed-reader.reel/feed-reader.js | 51 +++++++++++++++++++++ node_modules/montage/ui/map.reel/map.html | 31 ++----------- node_modules/montage/ui/map.reel/map.js | 41 +++++------------ 10 files changed, 125 insertions(+), 61 deletions(-) create mode 100644 node_modules/montage/examples/feed-reader/images/47-fuel.png create mode 100644 node_modules/montage/examples/feed-reader/images/80-shopping-cart.png create mode 100644 node_modules/montage/examples/feed-reader/images/88-beer-mug.png (limited to 'node_modules') diff --git a/node_modules/montage/examples/feed-reader/images/47-fuel.png b/node_modules/montage/examples/feed-reader/images/47-fuel.png new file mode 100644 index 00000000..617d7640 Binary files /dev/null and b/node_modules/montage/examples/feed-reader/images/47-fuel.png differ diff --git a/node_modules/montage/examples/feed-reader/images/80-shopping-cart.png b/node_modules/montage/examples/feed-reader/images/80-shopping-cart.png new file mode 100644 index 00000000..51a5f86f Binary files /dev/null and b/node_modules/montage/examples/feed-reader/images/80-shopping-cart.png differ diff --git a/node_modules/montage/examples/feed-reader/images/88-beer-mug.png b/node_modules/montage/examples/feed-reader/images/88-beer-mug.png new file mode 100644 index 00000000..b0fdd99a Binary files /dev/null and b/node_modules/montage/examples/feed-reader/images/88-beer-mug.png differ diff --git a/node_modules/montage/examples/feed-reader/main.reel/main.html b/node_modules/montage/examples/feed-reader/main.reel/main.html index 8ea9a79b..ef4fc92a 100644 --- a/node_modules/montage/examples/feed-reader/main.reel/main.html +++ b/node_modules/montage/examples/feed-reader/main.reel/main.html @@ -79,6 +79,13 @@ "element": {"#": "map"} } }, + + "types": { + "prototype": "montage/ui/select-input.reel", + "properties": { + "element": {"#": "types"} + } + }, "owner": { "module": "main.reel", @@ -92,6 +99,10 @@ "mapCenter": { "boundObject": {"@": "mapCenter"}, "boundObjectPropertyPath": "value" + }, + "mapCategory": { + "boundObject": {"@": "types"}, + "boundObjectPropertyPath": "value" } } } @@ -140,6 +151,10 @@ visibility: hidden; } + #map, #feed-reader { + margin-top: 10px; + } + @@ -168,6 +183,17 @@
Location: +
+ Show: + +
Map
diff --git a/node_modules/montage/examples/feed-reader/main.reel/main.js b/node_modules/montage/examples/feed-reader/main.reel/main.js index bea5f91a..06d8fdba 100644 --- a/node_modules/montage/examples/feed-reader/main.reel/main.js +++ b/node_modules/montage/examples/feed-reader/main.reel/main.js @@ -13,6 +13,16 @@ exports.Main = Montage.create(Component, { distinct: true }, + mapCategory: { + get: function() { + return this._mapCategory; + }, + set: function(value) { + this._mapCategory = value; + this.map.category = value; + } + }, + feedReader: {value: null}, map: {value: null}, diff --git a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html index 213b4602..6c3a5298 100644 --- a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html +++ b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html @@ -61,7 +61,6 @@ .feed-entry { padding: 10px; margin: 3px 0; - border: 1px solid #aaa; } .feed-entry h2 { font-size: 24px; diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html index a3523001..646fd01e 100644 --- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html @@ -53,7 +53,15 @@ "module": "montage/ui/feed-reader/feed-reader.reel", "name": "FeedReader", "properties": { - "element": {"#": "feed-reader"} + "element": {"#": "feed-reader"}, + "repetition": {"@": "repetition"} + }, + "bindings": { + "items": { + "boundObject": {"@": "repetition"}, + "boundObjectPropertyPath": "objects", + "oneway": true + } } } @@ -61,8 +69,20 @@ diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js index 838a957d..d5c9ca17 100644 --- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js @@ -40,7 +40,13 @@ exports.FeedReader = Montage.create(Component, { this._fetchFeed(); } }, + + // time in ms between slides + interval: {value: 3000, distinct: true}, + + repetition: {enumerable: false, value: null}, + maxEntries: {value: 10, distinct: true}, entries: {value: null}, @@ -55,6 +61,51 @@ exports.FeedReader = Montage.create(Component, { //Notifier.hide(); } }, + + + feedEntryTimer: {enumerable: false, value: null}, + _items: { + value: null + }, + items: { + get: function() { + return this._items; + }, + set: function(value) { + this._items = value; + // reset the counter + console.log('got items'); + this.activeIndex = 0; + + if(this.feedEntryTimer) { + window.clearInterval(this.feedEntryTimer); + } + var self = this, maxEntries = self.maxEntries; + + this.feedEntryTimer = setInterval(function() { + var index = self.activeIndex + 1; + if(index > maxEntries) { + index = 0; + } + if(index < 0) { + index = 0; + } + self.activeIndex = index; + + }, this.interval); + } + }, + + _activeIndex: {value: null}, + activeIndex: { + get: function() { + return this._activeIndex || 0; + }, + set: function(value) { + this._activeIndex = value; + this.repetition.activeIndexes = [value]; + } + }, _fetchFeed: { value: function() { diff --git a/node_modules/montage/ui/map.reel/map.html b/node_modules/montage/ui/map.reel/map.html index 5cd3a5b5..b255ac1e 100644 --- a/node_modules/montage/ui/map.reel/map.html +++ b/node_modules/montage/ui/map.reel/map.html @@ -13,24 +13,13 @@ @@ -49,20 +38,8 @@ -
-
- Show: - -
-
MAP
- +
+
MAP
diff --git a/node_modules/montage/ui/map.reel/map.js b/node_modules/montage/ui/map.reel/map.js index c03d51c5..305ae181 100644 --- a/node_modules/montage/ui/map.reel/map.js +++ b/node_modules/montage/ui/map.reel/map.js @@ -42,34 +42,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ enumerable: false, value: false }, - _latitude: { - enumerable: false, - value: -34.397 - }, - latitude: { - enumerable: false, - set: function(value) { - this._latitude = value; - this.needsDraw = true; - }, - get: function() { - return this._latitude; - } - }, - _longitude: { - enumerable: false, - value: -34.397 - }, - longitude: { - enumerable: false, - set: function(value) { - this._longitude = value; - this.needsDraw = true; - }, - get: function() { - return this._longitude; - } - }, + defaultLatLng: { value: {lat: -34.397, lng: 150.644} @@ -132,6 +105,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ return this._category; }, set: function(value) { + console.log('category set: ' + value); if(value) { this._category = value; this._getPlaces(this._category); @@ -170,6 +144,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ } var service = new google.maps.places.PlacesService(this._map); service.search(request, function(results, status) { + console.log('got places for ', self.category, status, results); if (status == google.maps.places.PlacesServiceStatus.OK) { self._places = results; } else { @@ -192,12 +167,18 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ case 'hospital': icon = '10-medical.png'; break; - case 'cafe': - icon = '34-coffee.png'; + case 'bar': + icon = '88-beer-mug.png'; + break; + case 'grocery_or_supermarket': + icon = '80-shopping-cart.png'; break; case 'museum': icon = '41-picture-frame.png'; break; + case 'gas_station': + icon = '47-fuel.png'; + break; }; if(icon) { image = new google.maps.MarkerImage('images/' + icon); -- cgit v1.2.3 From ec58642a7b31165890eb5bef7d95ce59dd0c34a0 Mon Sep 17 00:00:00 2001 From: Kishore Subramanian Date: Mon, 19 Mar 2012 14:14:29 -0700 Subject: Changes to Map and FeedReader - Added traffic property to Map - Support for show/hide traffic in the example - Changed FeedReader to use only one DIV. No longer uses Repetition - Support multiple modes in the Feed reader - timed/animated--- .../examples/feed-reader/main.reel/main.html | 32 +++++- .../ui/feed-reader/feed-entry.reel/feed-entry.js | 10 +- .../feed-reader/feed-reader.reel/feed-reader.html | 38 +----- .../ui/feed-reader/feed-reader.reel/feed-reader.js | 127 ++++++++++++--------- node_modules/montage/ui/map.reel/map.js | 29 ++++- 5 files changed, 148 insertions(+), 88 deletions(-) (limited to 'node_modules') diff --git a/node_modules/montage/examples/feed-reader/main.reel/main.html b/node_modules/montage/examples/feed-reader/main.reel/main.html index ef4fc92a..50bac601 100644 --- a/node_modules/montage/examples/feed-reader/main.reel/main.html +++ b/node_modules/montage/examples/feed-reader/main.reel/main.html @@ -44,7 +44,9 @@ "module": "montage/ui/feed-reader/feed-reader.reel", "name": "FeedReader", "properties": { - "element": {"#": "feed-reader"} + "element": {"#": "feed-reader"}, + "feedDisplayMode": "timed", + "interval": "5" } }, @@ -76,7 +78,14 @@ "map": { "prototype": "montage/ui/map.reel", "properties": { - "element": {"#": "map"} + "element": {"#": "map"}, + "traffic": false + }, + "bindings": { + "traffic": { + "boundObject": {"@": "traffic"}, + "boundObjectPropertyPath": "checked" + } } }, @@ -86,6 +95,12 @@ "element": {"#": "types"} } }, + "traffic": { + "prototype": "montage/ui/checkbox.reel", + "properties": { + "element": {"#": "traffic"} + } + }, "owner": { "module": "main.reel", @@ -155,6 +170,18 @@ margin-top: 10px; } + /* + .feed-reader .feed-entry { + visibility:hidden; + opacity:0; + transition:visibility 0s linear 0.5s,opacity 0.5s linear; + } + .feed-reader .feed-entry .active { + visibility:visible; + opacity:1; + transition-delay:0s; + } + */ @@ -194,6 +221,7 @@
+ Show Traffic
Map
diff --git a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js index 3d97eec7..72c5023e 100644 --- a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js +++ b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js @@ -8,6 +8,14 @@ var Montage = require("montage").Montage, exports.FeedEntry = Montage.create(Component, { - entry: {value: null} + _entry: {value: null}, + entry: { + get: function() { + return this._entry; + }, + set: function(value) { + this._entry = value; + } + } }); diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html index 646fd01e..e5251e0a 100644 --- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html @@ -23,17 +23,7 @@ } } }, - - "repetition": { - "module": "montage/ui/repetition.reel", - "name": "Repetition", - "properties": { - "element": {"#": "entries"}, - "contentController": {"@": "entriesController"}, - "isSelectionEnabled": true, - "orientation": "vertical" - } - }, + "feedEntry": { "module": "montage/ui/feed-reader/feed-entry.reel", "name": "FeedEntry", @@ -42,27 +32,19 @@ }, "bindings": { "entry": { - "boundObject": {"@": "repetition"}, - "boundObjectPropertyPath": "objectAtCurrentIteration", + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "activeFeedEntry", "oneway": true } - } + } }, "owner": { "module": "montage/ui/feed-reader/feed-reader.reel", "name": "FeedReader", "properties": { - "element": {"#": "feed-reader"}, - "repetition": {"@": "repetition"} - }, - "bindings": { - "items": { - "boundObject": {"@": "repetition"}, - "boundObjectPropertyPath": "objects", - "oneway": true - } - } + "element": {"#": "feed-reader"} + } } } @@ -74,16 +56,8 @@ } .feed-entry { - display: none; - } - - .montage-hidden { - display: none; } - .active { - display: block; - } diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js index d5c9ca17..8fd9ae22 100644 --- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js @@ -42,92 +42,117 @@ exports.FeedReader = Montage.create(Component, { }, // time in ms between slides - interval: {value: 3000, distinct: true}, - - repetition: {enumerable: false, value: null}, + interval: {value: 3, distinct: true}, maxEntries: {value: 10, distinct: true}, - entries: {value: null}, - - - _startLoading: { - value: function() { - //Notifier.show('Loading ... please wait', null, {top: this.element.style.top, left: this.element.style.left + 20}); - } - }, - - _stopLoading: { - value: function() { - //Notifier.hide(); - } - }, + entries: {value: null}, - feedEntryTimer: {enumerable: false, value: null}, - _items: { - value: null - }, - items: { + _feedDisplayMode: {value: null}, + feedDisplayMode: { get: function() { - return this._items; + return this._feedDisplayMode; }, set: function(value) { - this._items = value; - // reset the counter - console.log('got items'); - this.activeIndex = 0; - - if(this.feedEntryTimer) { - window.clearInterval(this.feedEntryTimer); - } - var self = this, maxEntries = self.maxEntries; - - this.feedEntryTimer = setInterval(function() { - var index = self.activeIndex + 1; - if(index > maxEntries) { - index = 0; - } - if(index < 0) { - index = 0; - } - self.activeIndex = index; - - }, this.interval); + this._feedDisplayMode = value; } }, + + feedEntryTimer: {enumerable: false, value: null}, + + + activeFeedEntry: {value: null}, _activeIndex: {value: null}, activeIndex: { get: function() { return this._activeIndex || 0; }, - set: function(value) { - this._activeIndex = value; - this.repetition.activeIndexes = [value]; + set: function(index) { + if(this.entries) { + var max = this.entries.length-1; + if(index > max) { + index = 0; + } + if(index < 0) { + index = 0; + } + this._activeIndex = index; + this.activeFeedEntry = this.entries[this._activeIndex]; + } else { + this._activeIndex = 0; + } } }, _fetchFeed: { value: function() { + var url = this.feedURL; var feed = new google.feeds.Feed(url); feed.setNumEntries(10); var self = this; - - this._startLoading(); self.entries = []; feed.load(function(result) { - self._stopLoading(); + //self.removeEntryAnimation(); if(result.error) { self.entries = []; } else { - //console.log('entries: ', result.feed.entries); + //console.log('entries: ', result.feed.entries); self.entries = result.feed.entries; + this._activeIndex = 0; } + + }); } + }, + + addEntryAnimation: { + value: function() { + var self = this; + if("animation" == this.feedDisplayMode) { + this.element.addEventListener('animationend', this); + } else { + // timer + this.feedEntryTimer = setInterval(function() { + self.activeIndex = self.activeIndex + 1; + }, (this.interval * 1000)); + } + } + }, + + removeEntryAnimation: { + value: function() { + if("animation" == this.feedDisplayMode) { + this.element.removeEventListener('animationend', this); + } else { + if(this.feedEntryTimer) { + window.clearInterval(this.feedEntryTimer); + } + } + } + }, + + handleAnimationend: { + value: function() { + console.log('animation end'); + this.activeIndex = this.activeIndex + 1; + } + }, + + prepareForDraw: { + value: function() { + this.addEntryAnimation(); + } + }, + + draw: { + value: function() { + + } } }); diff --git a/node_modules/montage/ui/map.reel/map.js b/node_modules/montage/ui/map.reel/map.js index 305ae181..42af218e 100644 --- a/node_modules/montage/ui/map.reel/map.js +++ b/node_modules/montage/ui/map.reel/map.js @@ -114,6 +114,21 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ } }, + trafficLayer: {value: null}, + _traffic: {value: null}, + traffic: { + get: function() { + return this._traffic; + }, + set: function(value) { + if(value !== this._traffic) { + this._traffic = value; + this.needsDraw = true; + } + } + }, + + zoomValue: { value: 8 }, @@ -239,7 +254,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ this._map = new window.google.maps.Map(this.mapEl, myOptions); } else { var map = this._map; - map.setZoom(12); + map.setZoom(10); var latLng = new window.google.maps.LatLng(latLng.lat, latLng.lng); map.setCenter(latLng); var marker = new google.maps.Marker({ @@ -249,11 +264,21 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ var places = this._places; if(places && places.length > 0) { + map.setZoom(13); this._removeAllMarkers(); for (var i = 0; i < places.length; i++) { this._createMarker(places[i]); } - } + } + + if(this.traffic === true) { + this.trafficLayer = new google.maps.TrafficLayer(); + this.trafficLayer.setMap(map); + } else { + if(this.trafficLayer) { + this.trafficLayer.setMap(null); + } + } } } -- cgit v1.2.3 From ea439c4471948cb7e1dbb98bfa9c2ddc374d48e7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 19 Mar 2012 14:19:48 -0700 Subject: Maps - Apply default width and height styles to components if specified. Change default location to Sunnyvale. Signed-off-by: Nivesh Rajbhandari --- node_modules/components-data/map.json | 8 +++++++- node_modules/montage/ui/map.reel/map.html | 4 ++-- node_modules/montage/ui/map.reel/map.js | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'node_modules') diff --git a/node_modules/components-data/map.json b/node_modules/components-data/map.json index 796b2fad..792a7fe5 100644 --- a/node_modules/components-data/map.json +++ b/node_modules/components-data/map.json @@ -18,5 +18,11 @@ "default": "" } - ] + ], + + "defaultStyles": { + "width": "280px", + "height": "280px" + } + } \ No newline at end of file diff --git a/node_modules/montage/ui/map.reel/map.html b/node_modules/montage/ui/map.reel/map.html index b255ac1e..b39a11a9 100644 --- a/node_modules/montage/ui/map.reel/map.html +++ b/node_modules/montage/ui/map.reel/map.html @@ -29,8 +29,8 @@ .montage-google-map { margin: 0; padding: 0; - width: 600px; - height: 700px; + width: 280px; + height: 280px; } diff --git a/node_modules/montage/ui/map.reel/map.js b/node_modules/montage/ui/map.reel/map.js index 42af218e..cba08a42 100644 --- a/node_modules/montage/ui/map.reel/map.js +++ b/node_modules/montage/ui/map.reel/map.js @@ -43,9 +43,9 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ value: false }, - + // Sunnyvale, CA defaultLatLng: { - value: {lat: -34.397, lng: 150.644} + value: {lat: 37.37, lng: -122.03} }, _latLng: { -- cgit v1.2.3 From e506900b036f237f7d16238348fef12157deb173 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 19 Mar 2012 14:25:54 -0700 Subject: "Category" property should use "select" control. Signed-off-by: Nivesh Rajbhandari --- node_modules/components-data/map.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'node_modules') diff --git a/node_modules/components-data/map.json b/node_modules/components-data/map.json index 792a7fe5..655d222d 100644 --- a/node_modules/components-data/map.json +++ b/node_modules/components-data/map.json @@ -8,8 +8,8 @@ "properties": [ { "name": "category", - "type": "string", - "default": "", + "type": "select", + "default": "restaurant", "possibleValues": ["restaurant", "hospital", "cafe", "museum"] }, { -- cgit v1.2.3 From dd382088b4990c4e39f77d793c1a6bd7e3c52aca Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 19 Mar 2012 14:30:22 -0700 Subject: Map - width and height should be 100% so resize handles work. Signed-off-by: Nivesh Rajbhandari --- node_modules/montage/ui/map.reel/map.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'node_modules') diff --git a/node_modules/montage/ui/map.reel/map.html b/node_modules/montage/ui/map.reel/map.html index b39a11a9..abb51ddd 100644 --- a/node_modules/montage/ui/map.reel/map.html +++ b/node_modules/montage/ui/map.reel/map.html @@ -29,8 +29,8 @@ .montage-google-map { margin: 0; padding: 0; - width: 280px; - height: 280px; + width: 100%; + height: 100%; } -- cgit v1.2.3