Createjs : Container.getBounds() and Container.getTransformedBounds() returns null - createjs

I have a container and I have added a couple of bitmaps to it and scaled the whole container. Now when I call getTransformedBounds() on it, it returns null.
let innerContainer = new createjs.Container();
innerContainer.addChild(bitmap1);
innerContainer.addChild(bitmap2);
innerContainer.scaleX=scale;
innerContainer.scaleY=scale;
let phBounds = innerContainer.getTransformedBounds();
Here phBounds is null. It was working all these days. Suddenly today it is returning null. Strange.
Any help greatly appreciated.

Did you wait for the Bitmap image to load? If not, the bounds will be null because there is no content to measure. I wrote a quick test, and everything looks like its working fine:
https://codepen.io/gskinner/pen/bWEoaQ

Related

openlayers error on draw/modify (in vuejs)

The code I am using is in my previous question (resolved)
The interaction works perfectly and my goal is to get an array of coordinates, also works perfectly. Although everything works, I am getting an error in console every time I move the mouse in the display area. It doesn't affect functioning, but obviously I need to solve it... any ideas?
Draw.js?ac29:579 Uncaught TypeError: Cannot read property 'getGeometry' of null
at Draw.modifyDrawing_ (Draw.js?ac29:579)
at Draw.handlePointerMove_ (Draw.js?ac29:479)
at Draw.handleEvent (Draw.js?ac29:871)
at Map.handleMapBrowserEvent (PluggableMap.js?fe37:924)
at MapBrowserEventHandler.boundListener (events.js?1e8d:41)
at MapBrowserEventHandler.dispatchEvent (Target.js?0ec0:101)
at MapBrowserEventHandler.handlePointerMove_ (MapBrowserEventHandler.js?2ad6:260)
at PointerEventHandler.boundListener (events.js?1e8d:41)
at PointerEventHandler.dispatchEvent (Target.js?0ec0:101)
at PointerEventHandler.fireNativeEvent (PointerEventHandler.js?b114:397)
I'm trying something quite random, but you maybe want to add some condition in you current code:
var modify = new Modify({source: source});
modify.on('modifyend',function(e){
if(e.features && e.features.getArray().length) { //add this line
console.log("feature id is",e.features.getArray()[0].getGeometry().getCoordinates()[0]);
}
});

Looping Master or Scene and restoring original position of elements

I try to loop a complete header animation endlessly, but I just cannot get it to work:
https://codepen.io/Sixl/pen/jwXGqd
I tried to loop the master like this:
var master = new TimelineMax({repeat:-1});
Then I tried the same solution on the single scene I'm using:
function sceneOne() {
var tl = new TimelineMax({repeat:-1});
I also tried several solutions with oncomplete callbacks.
I finally had some experiments with
timeline.seek(0).pause();
timeline.pause(0); //shortcut for the line above
timeline.progress(0).pause();
timeline.totalProgress(0).pause();
timeline.restart(0).pause();
inside my scene. Didn't help.
Can somebody point me in the right direction? I cannot find any error in my code.
It is the entry_heroes section that is causing the problem as it has itself a repeat: -1 that means that the section never ends and so the whole timeline never finishes and thus does not repeat.

Easeljs getBounds, when are dimensions set?

I'm importing someone's createjs application into an application loader which imports each developers application javascript to a global canvas. The application is working standalone but when I load the javascript dynamically I'm getting some strange behavior surrounding the getBounds() function.
I have some text created like this:
dialogText = new createjs.Text(text, 'bold ' + (28 * scale) + 'px Calibri', '#FFFFFF');
Then later on I use dialogText.getBounds() which returns null.
I try console logging dialogText and I can see that it is set and there is a value _bounds which reads null.
At what point do these values get set when the element in drawn to the canvas?
Note: I'm already adding the text to a createjs.Container() which has its bounds set before I run getBounds().
For a quick reference, I pasted EaselJS's update regarding getBounds():
(This dates back from "August 21, 2013", not sure if this is still necessary nowadays, but using setBounds(x, y, w, h) helped me with Shapes today [in 2017] actually!)
Source: http://blog.createjs.com/update-width-height-in-easeljs/
The _bounds property reflects a value that is manually set on the DisplayObject - which is helpful if you know the bounds of something that can't calculate it (like a Shape). It will always be null, unless you set it directly.
I tested your code, and it seems fine. Are you sure the scale or text values are not null? Maybe hard-code them to see if it works.
Do you have a sample somewhere? I noticed in the GitHub issue you posted that you mentioned it worked fine without RequireJS (though you don't mention that here). I would definitely ensure that the values are being set properly.
Here is the fiddle, as well as a simpler one with no EaselJS stage. Note that I have Calibri installed on my machine, so you might get different results if you are loading it in.
Sample code:
var dialogText = new createjs.Text("This is some text", 'bold ' + (28 * 1.5) + 'px Calibrix', '#FFFFFF');
console.log(">>",dialogText.getBounds());

Opencart shows variable instead text

my store suddenly starts to show just the variables, instead the text of the variable.
i already check the controller, and it looks okay.
the footer shows like this:
text_address
text_address_cnt
and the content of theses variables is
$_['text_address'] = 'Endereço';
$_['text_address_cnt'] = 'Endereço da sua loja';
the controller looks like:
$data['text_address'] = $this->language->get('text_address');
$data['text_address_cnt'] = $this->language->get('text_address_cnt');
anyone went through this?
ps: store version 2.0.2
I made a new store and works ok... Still don't know why this has happened.

Xbox One Right Trigger Not Working

I have an Xbox One controller setup with Unity3d, and when I try to use the RT button nothing happens.
With the following setup, the RB button works fine:
I have looked at this but setting that up doesn't make sense to me. I have tried 3rd Axis 0_10th and I have tried 3rd Axis 0_1 but those are not valid. What is the proper settings for this to work?
To the get the result I was looking for, I needed to set it up the following way:
Then to get the button to work we need to use:
if(Mathf.Round(Input.GetAxisRaw("Fire1")) < 0){
// Firing code here
}
instead of:
if(Input.GetButton("Fire1")){
// Firing code here
}
Yes, thanks for posting. I was having the same problem using a 360 wired controller in Unity3d. It looks like the Left and Right triggers now both use the 3rd axis (Joystick) with the Left generating positive (0 to +1) values and the Right trigger generating negative (0 to -1) values. This differs from all the documentation I was finding.