Skip to content

Commit

Permalink
add example for zooming
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuan Nguyen committed Mar 1, 2019
1 parent 2dedff3 commit 529d538
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
21 changes: 20 additions & 1 deletion svyCanvasExample/forms/main.frm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ typeid:4,
uuid:"05632B44-0D12-4CAA-867A-86C39CF46E9A"
},
{
cssPosition:"543,-1,-1,78%,20%,28",
onActionMethodID:"6AF0BD59-C390-4F8F-9E06-93A32001A4C7",
onDoubleClickMethodID:"-1",
onRightClickMethodID:"-1",
text:"Zoom On Selection",
typeid:7,
uuid:"0776A644-0D83-4273-9896-6C66FD26B817"
},
{
cssPosition:"422,-1,-1,78%,20%,28",
onActionMethodID:"88EB32CA-0C89-469E-A2FE-30E18BD7A9B2",
onDoubleClickMethodID:"-1",
Expand Down Expand Up @@ -66,6 +75,15 @@ typeid:7,
uuid:"25F8EA2A-C7B3-4869-AF09-CE951B2AF130"
},
{
cssPosition:"576,-1,-1,78%,20%,28",
onActionMethodID:"7098A246-5056-4E41-9372-7DDCA305015A",
onDoubleClickMethodID:"-1",
onRightClickMethodID:"-1",
text:"Reset Zoom",
typeid:7,
uuid:"303EC8C7-4E84-42DF-BDC3-24EE56812154"
},
{
cssPosition:"192,-1,-1,78%,20%,28",
dataProviderID:"color",
displayType:2,
Expand Down Expand Up @@ -101,7 +119,7 @@ typeid:7,
uuid:"58C8C2FE-E127-4F1D-B4C4-CE38D3596F8E"
},
{
height:560,
height:632,
partType:5,
typeid:19,
uuid:"66F1115B-137F-49E2-9E83-E90683A0DF1B"
Expand All @@ -117,6 +135,7 @@ uuid:"6D7E7027-B2D9-44BE-B2E2-190C1D01EC16"
cssPosition:"0,-1,-1,0,75%,100%",
json:{
canvasOptions:{
ZoomOnMouseScroll:1,
svyUUID:"335540C4-1CDC-449F-A34E-11B500002182"
},
cssPosition:{
Expand Down
35 changes: 35 additions & 0 deletions svyCanvasExample/forms/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,38 @@ function onLoad(event) {
//allow user to edit
elements.canvas.canvasOptions.selectable = editable;
}

/**
* Perform the element default action.
*
* @param {JSEvent} event the event that triggered the action
*
* @private
*
* @properties={typeid:24,uuid:"6AF0BD59-C390-4F8F-9E06-93A32001A4C7"}
*/
function onAction$ZoomOnSelection(event) {
elements.canvas.getSelectedObject(cbZoom);
}

/**
* @param o
*
* @properties={typeid:24,uuid:"06D14A08-1038-4F40-9940-16E8D8A90142"}
*/
function cbZoom(o){
elements.canvas.ZoomOnPoint(o[0].x,o[0].y,1.5)
}

/**
* Perform the element default action.
*
* @param {JSEvent} event the event that triggered the action
*
* @private
*
* @properties={typeid:24,uuid:"7098A246-5056-4E41-9372-7DDCA305015A"}
*/
function onAction$resetZoom(event) {
elements.canvas.ZoomOnPoint(0,0,1)
}

0 comments on commit 529d538

Please sign in to comment.