Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    How to control display of plugin

    Scheduled Pinned Locked Moved Solved
    Plugins for DWC and DSF
    3
    7
    323
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stuartofmtundefined
      stuartofmt
      last edited by stuartofmt

      Let me start with a disclaimer. I know little of javascript and even less of .vue. This request is for a BFI (brute force and ignorance) solution , nothing eligant, just "good enough".

      I'm working on a plugin for DuetLapse3 and intend to display it's UI in an iFrame as part of the plugin.

      So far, so good. I have a basic plugin displaying but I want to make it's height larger (about twice), so as to better render the content of the iFrame. I've tried various (code by example) approaches to styling but have come up empty. This is, of course, down to me not knowing what I'm doing 😧

      Any help would be very much appreciated.

      Here is what it looks like now, the bottom part of the iFrame is cut-off 👎

      c3c109bc-6ad9-4ab7-9613-54cc917918fa-image.png

      Here is the relevent section of the vue file with what I have so far

      <style scoped>
      	.mydiv{
      	background-color: #000;
      	color: #fff;
      	border-radius: 8px;
      	display: flex;
      	}
      	.iframe-container {
      		position: relative;
      		overflow: auto;
      		background-color: transparent;
      	}
      	.iframe-container iframe {
      	position: absolute;
      		top: 0;
      		left: 0;
      		width: 100%;
      		height: 100%;
      		border: 0;
      	}			
      </style>
       
      <template>
      <div class="mydiv">
          <p>{{version}}<br>
      		<div class="iframe_container">
      			<iframe :src= "url" width="100%" height="100%" frameborder="0">
      				<span>Your browser does not support iFrames</span>
      			</iframe>
      		</div>
      </div>
      </template>
      
      Sindariusundefined 1 Reply Last reply Reply Quote 0
      • Sindariusundefined
        Sindarius @stuartofmt
        last edited by Sindarius

        @stuartofmt Because of how the flow works on the pages you'll most likely need to set a fixed height on your .myDiv style otherwise I believe it will simply fill the available space and you end up with the overflow in your container. You could also try to remove the overflow:auto on the .iframe-container and see if that helps.

        On the G-Code Viewer I deal with this on window resize events to fill the available space or to force a set height if the height is less than so many pixels.

        stuartofmtundefined MintyTreborundefined 2 Replies Last reply Reply Quote 0
        • stuartofmtundefined
          stuartofmt @Sindarius
          last edited by

          @Sindarius said in How to control display of plugin:

          likely need to set a fixed height on your .myDiv style ... You could also try to remove the overflow:auto on the .iframe-container and see if that helps.

          Thanks for the guidance, I tried setting an absolute height in the .myDiv style but that did not seem to have any affect (with or without overflow:auto). I do not need anything other than the iFrame - so I simplified it and forced the height (in px) in the actual iFrame. This works well enough 🙂

          <style scoped>
          	.iframe-container {
          		position: relative;
          		background-color: transparent;
          	}
          	.iframe-container iframe {
          	position: absolute;
          		top: 0;
          		left: 0;
          	}			
          </style>
           
          <template>
          		<div class="iframe_container">
          			<iframe :src= "myurl" width="100%" height="800px" frameborder="0">
          				<span>Your browser does not support iFrames</span>
          			</iframe>
          		</div>
          </template>
          
          Sindariusundefined 1 Reply Last reply Reply Quote 0
          • Sindariusundefined
            Sindarius @stuartofmt
            last edited by

            @stuartofmt glad you got it going. Solving layout/flow issues in pages is always a challenge. 🙃

            1 Reply Last reply Reply Quote 0
            • MintyTreborundefined
              MintyTrebor @Sindarius
              last edited by

              If it helps here is a simplified version of how I get the available screen space:

              computed: {
              	showBottomNavigation(): boolean {
              		return this.$vuetify.breakpoint.mobile && !this.$vuetify.breakpoint.xsOnly && this.$store.state.settings.bottomNavigation;
              	},
              },
              methods: {
              	getAvailScreenHeight(){
              		let tmpHeight = window.innerHeight - 90;
              		if(window.document.getElementById("global-container")){
              			tmpHeight = tmpHeight - window.document.getElementById("global-container")!.offsetHeight;
              		}
              		if(this.showBottomNavigation) {
              			tmpHeight = tmpHeight - 56;
              		}
              		return tmpHeight;
              	}
              }
              

              It gets the remaining screen height available, taking into account the height of the DWC top section, and if the tablet menu is shown at the bottom.

              NodeDSF - Native Node-Red integration with Duet boards.
              BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
              ReleaseMgr - Duet update info inside DWC.
              Repo

              stuartofmtundefined 1 Reply Last reply Reply Quote 1
              • stuartofmtundefined
                stuartofmt @MintyTrebor
                last edited by stuartofmt

                @MintyTrebor said in How to control display of plugin:

                It gets the remaining screen height available, taking into account the height of the DWC top section, and if the tablet menu is shown at the bottom.

                Many thanks for the assist. Its all workinhg now.

                I had to remove the ! from here tmpHeight = tmpHeight - window.document.getElementById("global-container")!.offsetHeight;

                but even more strangely I had to remove the : boolean from here showBottomNavigation(): boolean { It gave a syntax error on build?

                MintyTreborundefined 1 Reply Last reply Reply Quote 0
                • MintyTreborundefined
                  MintyTrebor @stuartofmt
                  last edited by

                  @stuartofmt It's because its in Typescript format and for DWC 3.5 - I probably should of mentioned that, I think I just assumed you were working in 3.5.

                  NodeDSF - Native Node-Red integration with Duet boards.
                  BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                  ReleaseMgr - Duet update info inside DWC.
                  Repo

                  1 Reply Last reply Reply Quote 0
                  • stuartofmtundefined stuartofmt marked this topic as a question
                  • stuartofmtundefined stuartofmt has marked this topic as solved
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA