I am trying to create background with sky, previously I used this method, but
It gives low quality picture on big screen, and I wanted to use instead Babylon.skyMaterial, as it is in documentation, but it throws errors, like
[Vue warn]: Error in mounted hook: "TypeError: babylonjs__WEBPACK_IMPORTED_MODULE_14__.SkyMaterial is not a constructor"
This is code that I used:
var box = BABYLON.MeshBuilder.CreateBox('SkyBox', { size: 1000.0 }, scene, false, BABYLON.Mesh.BACKSIDE); var boxMaterial = new BABYLON.SkyMaterial("sky", scene); boxMaterial.inclination = -0.15; box.material = boxMaterial;
Link for skyMaterial
Related
I'm having an issue in my project which uses Angular 5, NgRx, materialDesignBootstrap and chartsjs.
Essentially, when the charts are created, I get a list of console messages like the following (the charts properly display anyway):
Attempting to configure '_chartjs' with descriptor '[object Object]' on object '17.94,17.47,17.14,17.17,18.21,17.91,18.34,20.25,21.39' and got error, giving up: TypeError: Cannot define property _chartjs, object is not extensible - zone.js:2228
Attempting to configure 'push' with descriptor '{"configurable":true,"enumerable":false}' on object '17.94,17.47,17.14,17.17,18.21,17.91,18.34,20.25,21.39' and got error, giving up: TypeError: Cannot define property push, object is not extensible - zone.js:2228
Attempting to configure 'pop' with descriptor '{"configurable":true,"enumerable":false}' on object '17.94,17.47,17.14,17.17,18.21,17.91,18.34,20.25,21.39' and got error, giving up: TypeError: Cannot define property pop, object is not extensible - zone.js:2228
After a short investigation I read the doc about frozen object and found the code throwing these messages inside the chartsJs node_module folder, but i really don't know how to solve the issue.
Here is the charts markup:
<canvas mdbChart *ngIf="chartsData.length >= 1"
[chartType]="chartType"
[datasets]="chartsData"
[labels]="xLabels"
[colors]="chartColors"
[options]="chartOptions"
[legend]="chartsData && chartsData.length >= 1"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)">
</canvas>
and here is a piece of the ts file:
#Input() chartData: Array<object>;
#Input() xLabel: Array<string>;
xLabels: Array<string>;
chartsData: Array<object>;
ngOnChanges(changes: SimpleChanges) {
if( changes.xLabel && changes.xLabel.currentValue.length > 0 && changes.chartData && changes.chartData.currentValue.length > 0 ){
this.chartsData = changes.chartData.currentValue.map(item => Object.assign({}, item));
/** this workaround solves a mdb library bug not updating xAxis label*/
setTimeout(function () {
this.xLabels = changes.xLabel.currentValue.slice(0);
}.bind(this), 0);
}
}
as you can see above, i tried to clone the input objects (they both come from the ngRx state), but it didn't solve the issue.
I'll be happy to provide any needed information. And I'm sorry if this is not quite a workable example, but you probably know it would require a tons of files to make an angular 5 working example xD
I'm having an issue creating a Progress bar that tracks the real time progress of a VueX mutation.
I have a button component that runs a mutation when the user clicks the button. This mutation goes through an array and performs a function on each item in the array. While performing this function it updates a 'progress' status in the store. I have a progress bar component that reads this 'progress' status from the store as a computed property.
I was hoping that as the progress status updates so would the progress bar but it seems I am having an issue with the DOM Rendering the change as quickly as it is being updated. My mutation runs and the progress bar goes from 0 to 100 with no update in-between.
I guess I'm having an issue conceptualizing why my DOM isn't redrawing as quickly as I am updating the 'progress' status and if there is any way of accomplishing this
I've found that the 'For' loop I use to process my array 'freezes' the dom and stops it from re-rendering. To fix this I've used a 'setTimeout' call. This seems like a hack but will hopefully help someone else who comes up against this issue. More answers appreciated. thanks to #Eric Guan for putting me down this path. I found the answer on another post here -> How to stop intense Javascript loop from freezing the browser
var self = this;
var animals = ['dog', 'cat','lion','tiger','bear'];
var processing = function() {
var animal = animals.shift();
console.log(animal);
if (animals.length > 0) {
console.log(animals.length);
var timer = setTimeout(processing, 1000);
self.$store.commit('updateStatus', {progress : animals.length*20, msg: 'Progress Bar Test', status: 'processing', display: true});
} else {
console.log('clearing timeout');
self.$store.commit('updateStatus', {progress : 100, msg: 'Progress Bar Test', status: 'processing', display: false});
clearTimeout(timer);
}
}
processing();
When the function call below gets run it returns this error.
"Uncaught TypeError: Cannot read property 'backgroundColor' of
undefined" I am trying to change the background color of a class called
.jumbotron. I have tried everything I can thing of so far.
Could anyone tell me why this is happening?
clrElementJumbo("cornsilk");
function clrElementJumbo(scolor) {
var el = document.getElementsByClassName("jumbotron");
el.style.backgroundColor = scolor;
}
Try to replace the code
var el = document.getElementsByClassName("jumbotron");
with the following
var el=document.getElementsByClassName("jumbotron")[0];
I am trying to include an annotation on ti.maps module on Titanium sdk 5.1.1.GA, but I am getting this error:
message = "+[MKPinAnnotationView redPinColor]: unrecognized selector sent to class 0x10c2bb4e0";
has iOS updated MKPinAnnotationView ?, because it worked fine a couple days ago, and I took exactly the same code as in the official docs http://docs.appcelerator.com/platform/latest/#!/api/Modules.Map
So the code I am running is :
var Map = require('ti.map');
var win = Titanium.UI.createWindow();
var mountainView = Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor:Map.ANNOTATION_RED,
myid:1 // Custom property to uniquely identify this annotation.
});
var mapview = Map.createView({
mapType: Map.NORMAL_TYPE,
region: {latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:true,
annotations:[mountainView]
});
var circle = Map.createCircle({
center: { latitude: 33.74511, longitude: -84.38993 },
radius: 1000, //1km
fillColor: "#20FF0000"
});
mapview.addCircle(circle);
win.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {
Ti.API.info("Clicked " + evt.clicksource + " on " + evt.latitude + "," + evt.longitude);
});
win.open();
Does anyone has the same problem?
EDIT:
I think I found the problem, correct me if I am wrong it seems to be Titanium map module will be only supported with iOS SDK 9?, according with these changes : https://github.com/appcelerator-modules/ti.map/pull/127/files
If you're using TiSDK 5.1.# or higher, you should compile with Xcode 7. It might be that certain features are also iOS 9+, but should not fail to compile
I notice in the Apple Docs the pincolor feature has also changed in iOS 9, so it could be your map module is not yet up-to-date, or the map module has not been fitted with the latest iOS change, but I think that not to be true.
Update your ti.map module to the latest! You can find it here: http://gitt.io/component/ti.map
I have a function responsible for hiding/showing markers, so I decided to use removeMarkers() and addMarkers() with a variable which contains all markers displayed on map, preventing AJAX requests. However, removeMarkers() appears to not working when used after addMarkers() function:
#/assets/javascript/general.js.coffee
#buildMap = (markers)->
provider = Gmaps.build(
'Google',
{
builders: { Marker: RichMarkerBuilder},
markers:
clusterer:
gridSize: 50
styles: [
url: "/assets/cluster.png"
textSize: 15
width: 56
height: 56
]
}
)
Gmaps.handler = #clustereredHandler()
Gmaps.handler.buildMap {
provider: provider,
internal: {id: 'map'} }, ->
Gmaps.markers = _.map(markers, (marker_json) ->
marker = Gmaps.handler.addMarker(marker_json)
_.extend marker, marker_json
marker
)
Gmaps.map = Gmaps.handler.getMap()
Gmaps.handler.bounds.extendWith(Gmaps.markers)
Gmaps.handler.fitMapToBounds()
#app/views/stores/index.html.erb
buildMap(<%=raw #hash.to_json %>);
So, I have:
Handler on Gmaps.handler variable;
All markers on Gmaps.markers variable;
Map on Gmaps.map variable.
Steps to failure:
Load map - OK (All markers loaded correctly);
> Gmaps.handler.removeMarkers(Gmaps.markers) - OK (All markers hidden correctly);
> Gmaps.handler.addMarkers(Gmaps.markers) - OK (All markers shown correctly);
> Gmaps.handler.removeMarkers(Gmaps.markers) - FAILURE! (Markers still being displayed);
I'm using 2.1.2version. Is there any fix for it?
Thanks
According to my plunkr here, there is no bug with gmaps4rails.
I feel like you have an issue with your own functions (maybe dont use extend?) and replace with:
marker.json = marker_json
I cant tell much more since they are not included.
I think the issue is in saving the markers. Whenever you add new markers, you overwrite the old ones. Try
Gmaps.markers.push.apply(Gmaps.markers, Gmaps.handler.addMarkers(Gmaps.markers))
to append the new markers instead.