-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement zoom panel for control scale of media container (#409)
* Implement zoom panel for control scale of media container * Make zoom value is reflected in the settings panel immediately --------- Co-authored-by: Sangwon Oh <rock@airensoft.com>
- Loading branch information
Showing
9 changed files
with
157 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import OvenTemplate from 'view/engine/OvenTemplate'; | ||
import PanelManager from "view/global/PanelManager"; | ||
import LA$ from 'utils/likeA$'; | ||
|
||
|
||
const ZoomPanel = function($container, api, data){ | ||
const $root = LA$(api.getContainerElement()); | ||
const media = $root.find(".op-media-element-container"); | ||
|
||
let panelManager = PanelManager(); | ||
let zoomProperty = "--mediaZoom"; | ||
|
||
data.setFront = function(isFront){ | ||
if(isFront){ | ||
$root.find("#"+data.id).removeClass("background"); | ||
}else{ | ||
$root.find("#"+data.id).addClass("background"); | ||
} | ||
}; | ||
const onRendered = function($current, template){ | ||
//Do nothing | ||
}; | ||
const onDestroyed = function(template){ | ||
//Do nothing | ||
}; | ||
const events = { | ||
"click .op-setting-item": function (event, $current, template) { | ||
event.preventDefault(); | ||
let offset = LA$(event.currentTarget).attr("op-data-value"); | ||
let zoomFactor = api.getZoomFactor(); | ||
|
||
if (offset == 0) { | ||
zoomFactor = 1.0; | ||
} else { | ||
zoomFactor = parseFloat(zoomFactor) + parseFloat(offset); | ||
} | ||
|
||
if (zoomFactor <= 0 ) { | ||
zoomFactor = 0 | ||
} | ||
|
||
media.get().style.setProperty(zoomProperty, api.setZoomFactor(parseFloat(zoomFactor).toFixed(2))); | ||
}, | ||
"click .op-setting-title" : function(event, $current, template){ | ||
event.preventDefault(); | ||
panelManager.removeLastItem(); | ||
} | ||
}; | ||
|
||
return OvenTemplate($container, "ZoomPanel", api.getConfig(), data, events, onRendered, onDestroyed ); | ||
|
||
}; | ||
|
||
export default ZoomPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters