# \[Bug-1176, 2463\] View Canvas: useDefaultX properties are swapped

**URL:** <https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [May 8, 2021, 6:59pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507 "2021-05-08T18:59:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [May 8, 2021, 6:59pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/1 "2021-05-08T18:59:26Z")

</div>

I’ve been trying to use `ViewCanvas` the last few days and I’m finding a number of issues that I would assume are bugs.

Bug 1: The `useDefaultViewWidth` / `Height` options seem to be swapped. When I toggle the `useDefaultViewWidth`, it changes the height and when I toggle the `useDefaultViewHeight`, it changes the width.  
Bug 2: When I try to put a percentage in for the width or height, it doesn’t work. It just shrinks it down to it’s smallest possible size fitting it’s content.  
Bug 3: I’m guessing this is related to bug 2, but when I try to use the style `minWidth`, I’m getting the same problem. If I say `minWidth: 500`, it works as expected, but with `minWidth: 50%`, it breaks. This is true with the styles for the individual instances and the `defaultStyle`.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 8, 2021, 7:29pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/2 "2021-05-08T19:29:43Z")

</div>

1. I noticed the same thing and thought I had opened a bug for it, but I can’t find it for the life of me at this time. I’ll open an internal ticket now.

2. `width`, `height`, `left`, `right`, `top`, and `bottom` are all [documented](https://docs.inductiveautomation.com/display/DOC80/Perspective+-+View+Canvas) as being “numeric” value types, because they are all cast to pixel values.

3. See `2`.

---

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [May 8, 2021, 9:08pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/3 "2021-05-08T21:08:39Z")

</div>

So if I wanted the element to be 20% of the canvas, how would I do that?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 8, 2021, 9:33pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/4 "2021-05-08T21:33:38Z")

</div>

The View Canvas would have to be in a Coordinate Container (which must be in “fixed” mode).

Then you’d bind the width of the instance against the width of the View Canvas.

In the following screenshot, you can see that I’ve set my View Canvas to be 400px wide. I then bind the `width` of my instance against the `width` of my View Canvas and divide that value by `5`. Note that I’ve turned off `useDefaultHeight` (because it’s improperly swapped with `useDefaultWidth` at this time. If you specify to sue the defaults, then the default values will override any value you set for width/height of the instance.

 ![Screen Shot 2021-05-08 at 2.29.34 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/6/0680a3a5ea5d867e0b15709649b5e58ea2e28f29.png)

---

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [May 9, 2021, 5:44pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/5 "2021-05-09T17:44:15Z")

</div>

How could I do this with the parent not fixed?

---

<div class="post-metadata">

**Author:** ![ToMakPo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tomakpo/32/23875_2.png) [@ToMakPo](https://forum.inductiveautomation.com/u/ToMakPo)\
**Post date:** [May 9, 2021, 6:02pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/6 "2021-05-09T18:02:26Z")

</div>

> [@cmallonee](#):
>
> `width`, `height`, `left`, `right`, `top`, and `bottom` are all [documented](https://docs.inductiveautomation.com/display/DOC80/Perspective+-+View+Canvas) as being “numeric” value types, because they are all cast to pixel values.

Also, while percentages don't work with `width` and `height`, they work just fine with `top`, `left`, `bottom`, and `right`. It makes no since that it wouldn't work for `width` and `height` too. If this isn't a bug, it's an oversight.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [May 18, 2021, 10:17pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/7 "2021-05-18T22:17:51Z")

</div>

The issue with useDefaultHeight/Width being swapped has been resolved in ~~8.1.7~~ 8.1.8 (due to 8.1.7 being 8.1.6 with an emergency rollback).

I also located an internal ticket to allow for percentage values for positional properties. That ticket has NOT been addressed yet, but I have linked this thread to that issue so that we can update here when the work is completed.

---

<div class="post-metadata">

**Author:** ![tashby](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tashby/32/67562_2.png) [@tashby](https://forum.inductiveautomation.com/u/tashby)\
**Post date:** [June 18, 2021, 2:46pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/8 "2021-06-18T14:46:09Z")

</div>

We just installed 8.1.7 to resolve this exact issue, and it seems to still be prevalent in 8.1.7.

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [June 18, 2021, 2:49pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/9 "2021-06-18T14:49:05Z")

</div>

It was probably pushed back to 8.1.8 as they had to do an early release of 8.1.7 to fix an issue caused in 8.1.6.

---

<div class="post-metadata">

**Author:** ![tashby](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tashby/32/67562_2.png) [@tashby](https://forum.inductiveautomation.com/u/tashby)\
**Post date:** [June 18, 2021, 2:50pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/10 "2021-06-18T14:50:39Z")

</div>

Oh bummer. Any rough time frame on 8.1.8?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 18, 2021, 2:51pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/11 "2021-06-18T14:51:03Z")

</div>

Exactly that. Please see this post: [What happened to version 8.1.6 LTS? It appears to be gone!](http://forum.inductiveautomation.com/t/what-happened-to-version-8-1-6-lts-it-appears-to-be-gone/47418) I had updated this thread as soon as the fix was put in place, but that version of code wound up becoming 8.1.8 after my post due to the “emergency” release of 8.1.6 + one rollback. I will update the post which declared the fix version.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 18, 2021, 2:52pm UTC](https://forum.inductiveautomation.com/t/bug-1176-2463-view-canvas-usedefaultx-properties-are-swapped/46507/12 "2021-06-18T14:52:06Z")

</div>

8.1.8 is scheduled for early August.
