Logic Machine Forum
Widget and camera - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Widget and camera (/showthread.php?tid=869)



Widget and camera - JMM - 26.06.2017

HI !

When we install a camera in a widget, with the "auto open window" marked, it do not open automatically.

Has t he a solution for this issue ?

Regards.

JMM.


RE: Widget and camera - AEK - 26.06.2017

(26.06.2017, 11:10)JMM Wrote: HI !

When we install a camera in a widget, with the "auto open window" marked, it do not open automatically.

Has t he a solution for this issue ?

Regards.

JMM.

Hi
You can create additional plan in Vis structure for camera and open it via Frame in needed plan.
Just tested it, and it works (firmware 20160927)


RE: Widget and camera - JMM - 27.06.2017

Hi !

I found a solution for auto opening a camera on widget via js :

Code:
$("#widget-15 > div").trigger('vclick');

This solution works perfect with quick visualization but not wih user visualisation !
I don't understand why Sad
Somebody would have an idea ?

Regards
JMM



RE: Widget and camera - admin - 27.06.2017

You need to bind this event to the object that's opening the widget by using an additional CSS class (myclass):
Code:
$(function() {
  $('.myclass').on('vclick', function() {
    $("#widget-15 > div").trigger('vclick');
  });
});



RE: Widget and camera - JMM - 27.06.2017

Thank you for the answer Admin !

My code was already bound to an event.

Code:
  // Open widget on KNX command
  grp.listen('2/3/4', function(object, state) {
    if (state == 'value' && object.value == true ) {
        // Command to show widget
      $("#widget-15").removeClass('hide');
      $("#widget-15 > div").trigger('vclick');
     
    }
  }, true); // set to true to execute on same object value

It works perfect with quick visualization
   

but not with user visualization !
   

JMM.


RE: Widget and camera - admin - 27.06.2017

You need to switch to the plan that has your widget first with showPlan(plan_id)


RE: Widget and camera - JMM - 27.06.2017

HI,

The script here is which works well, it is not certainly very academic.... I does not follow a specialist of the js!

JMM.


Code:
// Init widget and change display and opacity
  $("#widget-27").removeClass('hide');
  $("#widget-27").css("display", "none").css("opacity", "0");
 
 // Open widget on KNX command
 grp.listen('2/3/4', function(object, state) {
   if (state == 'value' && object.value == true ) {
      // hide camera on widget In the case she would have remained open and triggered open button camera  
     $("#widget-27 > div").addClass('hide').trigger('vclick').css("pointer-events", "none");
     // Command to show widget
     $('#widget-27').css({'display':'block', 'opacity': '1', 'transform': 'perspective(800px)', 'top': '200px', 'left': '500px'});
   }
 }, true); // set to true to execute on same object value
 
 // Close widget on KNX command
 grp.listen('2/3/4', function(object, state) {
   if (state == 'value' && object.value == false ) {
      // Command to display widget
      $("#widget-27").css("display", "none").css("opacity", "0");
   }
 }, true); // set to true to execute on same object value