[Feedback] Perspective View Canvas

#1

Overview

Starting with the 8.0.6 nightly from today, we’ve introduced a new Perspective component: the View Canvas. The View Canvas allows the user to embedded multiple views in a coordinate based canvas. Think of it as a coordinate-y version of the flex repeater. The View Canvas also allows for smooth transitioning of views through CSS transitions. Feel free to post comments, questions, suggestions here.

Properties

  • instances: Array<ViewInstanceProps> - Array of view config objects
    • position: relative | absolute - Mode that defines how the element is positioned within the canvas. For position absolute, the view is placed within the canvas based on its top, left, bottom, right positions. Views that are positioned absolute do not participate in the flow of the document. For position relative, the view is placed within the canvas placed in the normal document flow and then offset by its top, left values. This is the same with left and right.
    • top: string | number - The top position of the view.
    • left: string | number - The left position of the view.
    • bottom: string | number - The bottom position of the view. Note: If both top and bottom are set, bottom is respected only if position is set to absolute and height is unspecified.
    • right: string | number - The right position of the view. Note: If both left and right are set, left is respected only if position is set to absolute and height is unspecified.
  • zIndex: number | auto - The z-order position of the view.
  • width: string | number - The width of the view.
  • height: string | number - The height of the view.
  • viewPath: string - The path of the view.
  • viewParams: Object - The parameters of the view.
  • style: StyleObject - The style of the view.
  • transitionSettings: TransitionSettingProps - Transition settings on each view. The properties affected by transition settings are top, left, bottom, right, and zIndex.
    • duration: string - Duration of the transition. Units are seconds or milliseconds.
      Example: 200ms
    • delay: string - Delay of the transition before it begins. Units are seconds or milliseconds. Example: 1s
    • timingFunction: string - A mathematical function that describes how fast one-dimensional values change during the transition. The transition can be described as a cubic-bezier or steps function. The presets for cubic-bezier functions are linear, ease, ease-in, ease-in-out, ease-out. The presets for steps functions are step-start and step-end.
  • enableTransitions: boolean - Determine whether transitions should be enabled
  • defaultStyle: StyleObject - The default style that is applied to all views. This can be overridden on an instance basis.
  • style: StyleObject - The style of the canvas.

Events

  • onInstanceClicked - Event fired when a view instance is clicked
    • index: number - The index of the view instance.
    • params: dictionary - The current view parameters of the view instance.
    • path: string - The path of the view instance.
    • position: dictionary - The position of the view instance in relation to the canvas.
      • top: number - The top position of the view instance
      • left: number - The left position of the view instance
      • bottom: number - The bottom position of the view instance
      • right: number - The right position of the view instance
    • size: dictionary - The size of the view instance
      • width: number - The width of the view instance
      • height: number - The height of the view instance
Example GIF

viewcanvas3

8 Likes

pinned #2
0 Likes

#3

Can you provide some insight on how the “Example GIF” is coded?

I created a simple canvas and added a couple (of the same) embedded views
image
I want to click the down arrow and have Task#1 slide up and out of canvas and Task#2 slides to the top.

My First Try was to create a custom property ‘Position’ on the canvas and I bound the top property of each instance (for example canvas.intances[0].top) to the ‘Position’ property. If ‘Position’ = 0 then top of Task#1 would be 0 and top of Task #2 would be 60; and if ‘Position’ =1 top of Task#1 would be -60 and top of Task #2 would be 0. I added a script to each button to change the custom ‘Position’ property and the Tasks moved to the correct posiiton but there is no animation they just immediately jump to the calculated position.

I also tried simply adding

	self.getSibling("ViewCanvas").props.instances[0].top=0
	self.getSibling("ViewCanvas").props.instances[1].top=60

as the script to the up arrow, and

     self.getSibling("ViewCanvas").props.instances[0].top=-60
     self.getSibling("ViewCanvas").props.instances[1].top=0

to the button arrow. But I got the same results. The Tasks just jump to position, no animaiton.

What script is used in the GIF when the ‘Forward’ and ‘Back’ buttons are clicked?

0 Likes

#4

What are your transitionSettings props (as well as enableTransitions) set to? The animation should be driven by the transition related properties on the component, not the script or a binding.

Since the views are jumping to the new positions, it sounds like there is a configuration issue on some of the properties.

0 Likes

#5

I think they are the default
image

If I type in a value in the property field the transition works but the click event doesn’t work.

0 Likes

#6

Hi @dkylep,

There currently is an issue with the view canvas where transitions aren’t playing if transitioning from and to 0. This is certainly not ideal, but try using a start/end position other than zero. I can keep you updated when this issue gets fixed.

2 Likes

#7

Perfect (well almost :grinning:)!
Thank you, just changing the value to 1 works.
image

1 Like

#8

Just an FYI, I’m seeing some odd behavior on my mobile device (iOS with Safari, Chrome and Google browsers)

My view canvas above has a black border around it just so I can see where the actual canvas is and it works great on the PC.

In the mobile browser the canvas items are appearing outside the canvas in a static state. They appear initially when canvas is loaded but do not move. Looks like this when I initially load the page
image
Canvas behaves ok, all items show in canvas and scroll fine but the items that are outside canvas still show in place.
image

0 Likes

#9

Hi @dkylep,

Would you mind DM’ing me the view if you can?

0 Likes

#10

I’m not really sure what “DM’ing me” means but I created a project with a view containing the View Canvas and uploaded it here. I confirmed the same behavior. Oddly enough though, if the canvas is close to the left edge of the view it seems fine. If it’s moved 200-300px away from edge it starts showing the embedded views outside the canvas.

Project :
CanvasBackup.zip (12.6 KB)

0 Likes

#11

Hi @dkylep,

Thanks for the upload. I’ll check out the project and let you know what I find.

P.S. DM means to direct message :slightly_smiling_face:

0 Likes

#12

@dkylep I’ve been able to reproduce the bug. I’ll file a ticket and keep you up to date when it gets fixed.

1 Like