Page 1 of 1

Reseting position of entities

PostPosted: Thu Jan 08, 2015 11:42 pm
by Killersan
Hello guys,

During our project we faced problem but first things first.

1. What we want to achieve:
Dragable window with button and empty space for element which will appear after click on the button.

2. We built test lab with dragable window (You can drag the window by clicking on the red header) and button (blue element), but after we move this window in any other not default position and clicked the button, new element appeared (green one) but the position of dragable window was reseted to it's default values. Is it a good behaviour or is it some kind of bug ?

3. Here is sample of code which You can use to see the problem live (below is client.js file).
Code: Select all
var Client = IgeClass.extend({
   classId: 'Client',
   init: function () {
      // Load our textures
      var self = this;
      this.gameTextures = {};
         // Create the HTML canvas

         // Start the engine
         ige.start(function (success) {
            // Check if the engine started successfully
            if (success) {
               // Add base scene data
            //   ige.addGraph('mainScene');

                    self.mainScene = new IgeScene2d()
                        .translateTo(0, 0, 0)
                    self.vp1 = new IgeViewport()
                    self.uiScene = new IgeScene2d()
                             var a ='Drag');
                            var b ='DragP');
                            if ('mDown')==!0 && a!=undefined && a!=null){
                                ige.$(a).translateTo(e.igeBaseX- b.x, e.igeBaseY - b.y, 0);
                    self._obj = new IgeUiEntity()
                        .mount(ige.$('uiScene')) ;
                    self._obj_1 = new IgeUiEntity()
                        .mouseDown(function (e) {
                            console.log('mouse down action on BP cn');
                        .mouseUp(function () {
                            console.log('mouse up action on BP cn');
                    self._obj_2 = new IgeUiEntity()
                        .mouseUp(function () {
                  'obj',new IgeUiEntity().width(100).height(100).backgroundColor('#00ff00').mount(self.uiScene));

if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { module.exports = Client; }

Update: It seems that only horizontaly alignment is reseted, vertical stays after window is moved so I think that this is wrong behaviour.
The problem was solved by removing this (.center(0)) parameter from entity, but still I think that entity shouldn't restore it's parameters after mouse event triggered.