SAPUI5-HTML
来源:互联网 发布:t在c语言中是什么意思 编辑:程序博客网 时间:2024/05/17 06:03
var oHtml = new sap.ui.core.HTML("html1", { content : "<div style='position:relative;background-color:black;width:64px;height:64px'>" + "<div style='position:absolute;background-color:rgb(200, 0, 0);width:8px;height:8px;top:28px;left:48px' ></div>" +"<div style='position:absolute;background-color:rgb(200,100, 0);width:8px;height:8px;top:18px;left:45px' ></div>" +"<div style='position:absolute;background-color:rgb(200,200, 0);width:8px;height:8px;top:11px;left:38px' ></div>" +"<div style='position:absolute;background-color:rgb(100,200, 0);width:8px;height:8px;top: 8px;left:28px' ></div>" +"<div style='position:absolute;background-color:rgb( 0,200, 0);width:8px;height:8px;top:11px;left:18px' ></div>" +"<div style='position:absolute;background-color:rgb( 0,200,100);width:8px;height:8px;top:18px;left:11px' ></div>" +"<div style='position:absolute;background-color:rgb( 0,200,200);width:8px;height:8px;top:28px;left: 8px' ></div>" +"<div style='position:absolute;background-color:rgb( 0,100,200);width:8px;height:8px;top:38px;left:11px' ></div>" +"<div style='position:absolute;background-color:rgb( 0, 0,200);width:8px;height:8px;top:45px;left:18px' ></div>" +"<div style='position:absolute;background-color:rgb(100, 0,200);width:8px;height:8px;top:48px;left:28px' ></div>" + "<div style='position:absolute;background-color:rgb(200, 0,200);width:8px;height:8px;top:45px;left:38px' ></div>" +"<div style='position:absolute;background-color:rgb(200, 0,100);width:8px;height:8px;top:38px;left:45px' ></div>" +"</div>", preferDOM : false, afterRendering : function(e) { if ( !e.getParameters()["isPreservedDOM"] ) { var $=e.getSource().$(); $.click(function(e) { addColorBlockAtCursor($, e, 64, 8); }); } } }); oPanel.addContent(oHtml); return oPanel; function rgb(r,g,b) { return 'rgb(' + Math.round(255*r) + ',' + Math.round(255*g) + ',' + Math.round(255*b) + ')'; } function hsb2rgb(h,s,b) { h = (360.0 * h / 255.0); s = s / 255.0; b = b / 255.0; var f,i,hTemp,p,q,t; if ( s == 0 ) { // color is on black-and-white center line return rgb(b,b,b); } else { // chromatic color h = (h % 360) / 60.0; // h is now IN [0,6) i = Math.floor(h); // largest integer <= h f = h - i; // fractional part of h p = b * (1.0 - s); q = b * (1.0 - (s * f)); t = b * (1.0 - (s * (1.0 - f))); switch(i) { case 0: return rgb(b,t,p); case 1: return rgb(q,b,p); case 2: return rgb(p,b,t); case 3: return rgb(p,q,b); case 4: return rgb(t,p,b); case 5: return rgb(b,p,q); } } } function addColorBlockAtCursor($, e, psize, size) { var oOffset; if (typeof e.offsetX === "undefined" ) { oOffset = jQuery(e.target).offset(); e.offsetX = e.pageX - oOffset.left; e.offsetY = e.pageY - oOffset.top; } var dx = e.offsetX - psize/2; var dy = -(e.offsetY - psize/2); var a = 2 * Math.PI + (dx < 0 ? Math.PI - Math.atan2(dy, -dx) : Math.atan2(dy, dx)); var h = a / 2 / Math.PI * 255.0; colorBlock(hsb2rgb(h, 255, 200), e.offsetX-4, e.offsetY-4, size).appendTo($); } function colorBlock(sColor, iX, iY, iSize) { return jQuery("<div/>"). attr("title", sColor). css({ "position" : "absolute", "background-color" : sColor, "top" : iY+"px", "left" : iX+"px", "width" : iSize+"px", "height" : iSize+"px" }). click(function(e) { jQuery(this).remove(); }); }
0 0
- SAPUI5-HTML
- SAPUI5
- SAPUI5-Button
- SAPUI5 Theme
- SAPUI5-List
- SAPUI5-Routing
- SAPUI5 Table
- SAPUI5 - Component
- SAPUI5 (21)
- SAPUI5 (22)
- SAPUI5 (23)
- SAPUI5 (24)
- SAPUI5 (25)
- SAPUI5 (26)
- SAPUI5 (27)
- SAPUI5 (29)
- SAPUI5 (30)
- SAPUI5 (31)
- Android Robtium ActivityUtils
- 求解最优二叉树所有叶子结点的带权路径长度之和
- Builder模式——设计模式学习
- 生产订单的 lock 与 unlock
- 学习Java Web开发[1]可上传图片的客户端开发
- SAPUI5-HTML
- iOS编程 界面布局 纯代码 VFL编写和添加 左右两个view,按比例设置大小
- for test test test
- 并发编程
- iOS 7原生二维码扫描中文gbk编码乱码的解决
- securtCRT上传或下载文件szrz
- 加速Android Studio/Gradle构建
- math.h中一些常用函数
- Android studio教程与问题汇总