当前位置: 首页 > news >正文

为什么学网站开发深圳网站设计收费标准

为什么学网站开发,深圳网站设计收费标准,网站优化人员,秦皇岛网站建设公司一、背景 由于自带的下拉图标是给水平布局的block使用#xff0c;放在垂直布局下显得别扭#xff0c;而且下拉选择后回修改image字段的图片#xff0c;这让我很不爽#xff0c;所以在原来的基础上稍作修改#xff0c;效果如下#xff1a; 二、使用说明 #xff08;1放在垂直布局下显得别扭而且下拉选择后回修改image字段的图片这让我很不爽所以在原来的基础上稍作修改效果如下 二、使用说明 1引入field_icon_dropdown.js到core文件夹中代码在下文 2将field_icon_dropdown注册到Blockly中这样在任意地方都可以使用如果不想注入直接用script标签引入也行代码如下 goog.require(Blockly.FieldIconDropDown); 3block定义代码如下下面代码是直接集成到一个完整block中以设置彩灯块为例 // ZE3P LED Blockly.Blocks[ZE3P_led] {init: function () {this.jsonInit({message0: %1,args0: [{type: field_icon_dropdown,name: COLOR,options: [{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_coral.svg,width: 48,height: 48,value: Red},{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_green.svg,width: 48,height: 48,value: Green},{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_blue.svg,width: 48,height: 48,value: Blue},{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_orange.svg,width: 48,height: 48,value: Orange},{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_yellow.svg,width: 48,height: 48,value: Yellow},{src: Blockly.mainWorkspace.options.pathToMedia icons/set-led_white.svg,width: 48,height: 48,value: White},],}],outputShape: Blockly.OUTPUT_SHAPE_ROUND,output: String,extensions: [colours_looks]});} } // ZE3P LED显示颜色 Blockly.Blocks[ZE3P_led_set_color] {init: function () {this.jsonInit({message0: %1%2,args0: [{type: field_image,src: Blockly.mainWorkspace.options.pathToMedia /extensions/ZE3P.png,width: 24,height: 24},{type: field_vertical_separator}],message1: 设置彩灯 %1 显示 %2 ,args1: [{type: field_pin_dropdown,name: INTERFACE,options: Blockly.Blocks.ZE3PInterfaceOptions,},{type: input_value,name: COLOR,}],category: Blockly.Categories.looks,extensions: [colours_looks, shape_statement]});} }; 4添加toolbox配置代码如下 block typeZE3P_led_set_color idZE3P_led_set_colorvalue nameCOLORshadow typeZE3P_ledfield nameCOLORRed/field/shadow/value /block 5转码实现以python为例代码如霞  // LED颜色 Blockly.Python[ZE3P_led] function (block) {let color block.getFieldValue(COLOR) || 0;const code LedColor. color;return [code, Blockly.Python.ORDER_ATOMIC]; }; // LED显示颜色 Blockly.Python[ZE3P_led_set_color] function (block) {const pin block.getFieldValue(INTERFACE) || ;const color Blockly.Python.valueToCode(block, COLOR, Blockly.Python.ORDER_ATOMIC) || ;return led.set_color(Interface.${pin}, ${color})\n; }; 提示如果采用注册方法最好本地编译一下使用javascript引入则不需要  三、效果展示 四、完整代码 完整field_icon_dropdown.js代码如下 use strict;goog.provide(Blockly.FieldIconDropDown); goog.require(Blockly.DropDownDiv);/*** 构造器* param icons* constructor*/ Blockly.FieldIconDropDown function (icons) {this.icons_ icons;// Example:// [{src: ..., width: 20, height: 20, value: machine_value}, ...]// 选择第一个为默认值const defaultValue icons[0].value;Blockly.FieldIconDropDown.superClass_.constructor.call(this, defaultValue);this.addArgType(icon_dropdown); }; goog.inherits(Blockly.FieldIconDropDown, Blockly.Field);/*** Json配置*/ Blockly.FieldIconDropDown.fromJson function (element) {return new Blockly.FieldIconDropDown(element[options]); };/*** 下拉面板宽度不需要修改3个图标宽度* type {number}* const*/ Blockly.FieldIconDropDown.DROPDOWN_WIDTH 168;/*** 颜色记录*/ Blockly.FieldIconDropDown.savedPrimary_ null;/*** 初始化*/ Blockly.FieldIconDropDown.prototype.init function (block) {if (this.fieldGroup_) {return;}// 下拉箭头大小const arrowSize 12;// 重建domthis.fieldGroup_ Blockly.utils.createSvgElement(g, {}, null);this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);// 字段宽度this.size_.width 44;// 图标this.imageElement_ Blockly.utils.createSvgElement(image, {height: 24 px,width: 24 px,x: 4 px,y: 4 px,}, this.fieldGroup_);this.setParentFieldImage(this.getSrcForValue(this.value_));// 下拉箭头位置this.arrowX_ 32;this.arrowY_ 10;if (block.RTL) {this.arrowX_ -this.arrowX_ - arrowSize;}// 下拉图标this.arrowIcon_ Blockly.utils.createSvgElement(image, {height: arrowSize px,width: arrowSize px,transform: translate( this.arrowX_ , this.arrowY_ )}, this.fieldGroup_);this.arrowIcon_.setAttributeNS(http://www.w3.org/1999/xlink,xlink:href, Blockly.mainWorkspace.options.pathToMedia dropdown-arrow.svg);this.mouseDownWrapper_ Blockly.bindEventWithChecks_(this.getClickTarget_(), mousedown, this, this.onMouseDown_); };/*** 鼠标放置样式*/ Blockly.FieldIconDropDown.prototype.CURSOR default;/*** 设置值*/ Blockly.FieldIconDropDown.prototype.setValue function (newValue) {if (newValue null || newValue this.value_) {return; // No change}if (this.sourceBlock_ Blockly.Events.isEnabled()) {Blockly.Events.fire(new Blockly.Events.Change(this.sourceBlock_, field, this.name, this.value_, newValue));}this.value_ newValue;this.setParentFieldImage(this.getSrcForValue(this.value_)); };/*** 设置当前选择图片*/ Blockly.FieldIconDropDown.prototype.setParentFieldImage function (src) {if (this.imageElement_ src) {this.imageElement_.setAttributeNS(http://www.w3.org/1999/xlink, xlink:href, src || );} };/*** 获取值*/ Blockly.FieldIconDropDown.prototype.getValue function () {return this.value_; };/*** 根据src获取值* param value* returns {*}*/ Blockly.FieldIconDropDown.prototype.getSrcForValue function (value) {for (var i 0, icon; icon this.icons_[i]; i) {if (icon.value value) {return icon.src;}} };/*** 下拉选择*/ Blockly.FieldIconDropDown.prototype.showEditor_ function () {if (Blockly.DropDownDiv.hideIfOwner(this)) {return;}Blockly.DropDownDiv.hideWithoutAnimation();Blockly.DropDownDiv.clearContent();// 构建下拉内容const contentDiv Blockly.DropDownDiv.getContentDiv();// Accessibility propertiescontentDiv.setAttribute(role, menu);contentDiv.setAttribute(aria-haspopup, true);for (let i 0, icon; icon this.icons_[i]; i) {// 按钮const button document.createElement(button);button.setAttribute(id, : i);button.setAttribute(role, menuitem);button.setAttribute(class, blocklyDropDownButton);button.title icon.alt;button.style.width icon.width px;button.style.height icon.height px;let backgroundColor this.sourceBlock_.getColour();if (icon.value this.getValue()) {backgroundColor this.sourceBlock_.getColourTertiary();button.setAttribute(aria-selected, true);}button.style.backgroundColor backgroundColor;button.style.borderColor this.sourceBlock_.getColourTertiary();// 事件Blockly.bindEvent_(button, click, this, this.buttonClick_);Blockly.bindEvent_(button, mouseup, this, this.buttonClick_);Blockly.bindEvent_(button, mousedown, button, function (e) {this.setAttribute(class, blocklyDropDownButton blocklyDropDownButtonHover);e.preventDefault();});Blockly.bindEvent_(button, mouseover, button, function () {this.setAttribute(class, blocklyDropDownButton blocklyDropDownButtonHover);contentDiv.setAttribute(aria-activedescendant, this.id);});Blockly.bindEvent_(button, mouseout, button, function () {this.setAttribute(class, blocklyDropDownButton);contentDiv.removeAttribute(aria-activedescendant);});// 图标const buttonImg document.createElement(img);buttonImg.src icon.src;button.setAttribute(data-value, icon.value);buttonImg.setAttribute(data-value, icon.value);button.appendChild(buttonImg);contentDiv.appendChild(button);}contentDiv.style.width Blockly.FieldIconDropDown.DROPDOWN_WIDTH px;// 设置颜色Blockly.DropDownDiv.setColour(this.sourceBlock_.getColour(), this.sourceBlock_.getColourTertiary());Blockly.DropDownDiv.setCategory(this.sourceBlock_.parentBlock_.getCategory());this.savedPrimary_ this.sourceBlock_.getColour();this.sourceBlock_.setColour(this.sourceBlock_.getColourSecondary(),this.sourceBlock_.getColourSecondary(),this.sourceBlock_.getColourTertiary());const scale this.sourceBlock_.workspace.scale;const secondaryYOffset (-(Blockly.BlockSvg.MIN_BLOCK_Y * scale) - (Blockly.BlockSvg.FIELD_Y_OFFSET * scale));const renderedPrimary Blockly.DropDownDiv.showPositionedByBlock(this, this.sourceBlock_, this.onHide_.bind(this), secondaryYOffset);if (!renderedPrimary) {const arrowX this.arrowX_ Blockly.DropDownDiv.ARROW_SIZE / 1.5 1;const arrowY this.arrowY_ Blockly.DropDownDiv.ARROW_SIZE / 1.5;this.arrowIcon_.setAttribute(transform, translate( arrowX , arrowY ) rotate(180));} };/*** 点击按钮*/ Blockly.FieldIconDropDown.prototype.buttonClick_ function (e) {const value e.target.getAttribute(data-value);this.setValue(value);Blockly.DropDownDiv.hide(); };/*** 关闭下拉面板时回掉*/ Blockly.FieldIconDropDown.prototype.onHide_ function () {if (this.sourceBlock_) {this.sourceBlock_.setColour(this.savedPrimary_,this.sourceBlock_.getColourSecondary(),this.sourceBlock_.getColourTertiary());}Blockly.DropDownDiv.content_.removeAttribute(role);Blockly.DropDownDiv.content_.removeAttribute(aria-haspopup);Blockly.DropDownDiv.content_.removeAttribute(aria-activedescendant);this.arrowIcon_.setAttribute(transform, translate( this.arrowX_ , this.arrowY_ )); };Blockly.Field.register(field_icon_dropdown, Blockly.FieldIconDropDown);五、关于我 作者陆志敏 联系761324428qq.com
文章转载自:
http://www.morning.qyjqj.cn.gov.cn.qyjqj.cn
http://www.morning.gmgnp.cn.gov.cn.gmgnp.cn
http://www.morning.mfnsn.cn.gov.cn.mfnsn.cn
http://www.morning.bsqkt.cn.gov.cn.bsqkt.cn
http://www.morning.thzwj.cn.gov.cn.thzwj.cn
http://www.morning.lhxkl.cn.gov.cn.lhxkl.cn
http://www.morning.chrbp.cn.gov.cn.chrbp.cn
http://www.morning.ggrzk.cn.gov.cn.ggrzk.cn
http://www.morning.yrbp.cn.gov.cn.yrbp.cn
http://www.morning.qtwd.cn.gov.cn.qtwd.cn
http://www.morning.tllws.cn.gov.cn.tllws.cn
http://www.morning.kpxzq.cn.gov.cn.kpxzq.cn
http://www.morning.gdgylp.com.gov.cn.gdgylp.com
http://www.morning.rwqj.cn.gov.cn.rwqj.cn
http://www.morning.tnrdz.cn.gov.cn.tnrdz.cn
http://www.morning.kcsx.cn.gov.cn.kcsx.cn
http://www.morning.nlglm.cn.gov.cn.nlglm.cn
http://www.morning.rjnrf.cn.gov.cn.rjnrf.cn
http://www.morning.fxxmj.cn.gov.cn.fxxmj.cn
http://www.morning.fbzyc.cn.gov.cn.fbzyc.cn
http://www.morning.mpflb.cn.gov.cn.mpflb.cn
http://www.morning.qrlsy.cn.gov.cn.qrlsy.cn
http://www.morning.djmdk.cn.gov.cn.djmdk.cn
http://www.morning.rhjsx.cn.gov.cn.rhjsx.cn
http://www.morning.pghry.cn.gov.cn.pghry.cn
http://www.morning.kpzrf.cn.gov.cn.kpzrf.cn
http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn
http://www.morning.knswz.cn.gov.cn.knswz.cn
http://www.morning.zbnts.cn.gov.cn.zbnts.cn
http://www.morning.ylph.cn.gov.cn.ylph.cn
http://www.morning.rfhmb.cn.gov.cn.rfhmb.cn
http://www.morning.tqxtx.cn.gov.cn.tqxtx.cn
http://www.morning.nkjnr.cn.gov.cn.nkjnr.cn
http://www.morning.tqbyw.cn.gov.cn.tqbyw.cn
http://www.morning.frfnb.cn.gov.cn.frfnb.cn
http://www.morning.wtcyz.cn.gov.cn.wtcyz.cn
http://www.morning.rrqbm.cn.gov.cn.rrqbm.cn
http://www.morning.hlkxb.cn.gov.cn.hlkxb.cn
http://www.morning.zxybw.cn.gov.cn.zxybw.cn
http://www.morning.qzpkr.cn.gov.cn.qzpkr.cn
http://www.morning.rhmk.cn.gov.cn.rhmk.cn
http://www.morning.hqgxz.cn.gov.cn.hqgxz.cn
http://www.morning.whothehellami.com.gov.cn.whothehellami.com
http://www.morning.thbkc.cn.gov.cn.thbkc.cn
http://www.morning.pqxjq.cn.gov.cn.pqxjq.cn
http://www.morning.tsrg.cn.gov.cn.tsrg.cn
http://www.morning.brwei.com.gov.cn.brwei.com
http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn
http://www.morning.nxstj.cn.gov.cn.nxstj.cn
http://www.morning.czxrg.cn.gov.cn.czxrg.cn
http://www.morning.clkjn.cn.gov.cn.clkjn.cn
http://www.morning.rjjys.cn.gov.cn.rjjys.cn
http://www.morning.qtfss.cn.gov.cn.qtfss.cn
http://www.morning.fddfn.cn.gov.cn.fddfn.cn
http://www.morning.drytb.cn.gov.cn.drytb.cn
http://www.morning.ltzkk.cn.gov.cn.ltzkk.cn
http://www.morning.trmpj.cn.gov.cn.trmpj.cn
http://www.morning.skdrp.cn.gov.cn.skdrp.cn
http://www.morning.zzaxr.cn.gov.cn.zzaxr.cn
http://www.morning.qjlkp.cn.gov.cn.qjlkp.cn
http://www.morning.nwclg.cn.gov.cn.nwclg.cn
http://www.morning.rkwlg.cn.gov.cn.rkwlg.cn
http://www.morning.mhcft.cn.gov.cn.mhcft.cn
http://www.morning.xsctd.cn.gov.cn.xsctd.cn
http://www.morning.kxypt.cn.gov.cn.kxypt.cn
http://www.morning.neletea.com.gov.cn.neletea.com
http://www.morning.smrty.cn.gov.cn.smrty.cn
http://www.morning.qcmhs.cn.gov.cn.qcmhs.cn
http://www.morning.zlbjx.cn.gov.cn.zlbjx.cn
http://www.morning.dbphz.cn.gov.cn.dbphz.cn
http://www.morning.mlcwl.cn.gov.cn.mlcwl.cn
http://www.morning.nwjd.cn.gov.cn.nwjd.cn
http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn
http://www.morning.jydhl.cn.gov.cn.jydhl.cn
http://www.morning.mlgsc.com.gov.cn.mlgsc.com
http://www.morning.jcwt.cn.gov.cn.jcwt.cn
http://www.morning.zcnfm.cn.gov.cn.zcnfm.cn
http://www.morning.kfclh.cn.gov.cn.kfclh.cn
http://www.morning.knmp.cn.gov.cn.knmp.cn
http://www.morning.jbtzx.cn.gov.cn.jbtzx.cn
http://www.tj-hxxt.cn/news/263918.html

相关文章:

  • 电子商务网站成本网站推广服务方案
  • 济南建站公司模板做网站一般有什么题目
  • sqlite开发网站国家骨干高职院校建设网站
  • 7款优秀网站设计欣赏收费网站设计方案
  • 小说网站收录了怎么做排名企业建设网站需注意哪些内容
  • 做色网站wordpress5无法创建目录
  • 网站备案 现场提交大连市建设厅网站
  • 旧安卓手机做网站仿锤子 wordpress
  • 烫画图案设计网站网站设计网站建站
  • 西安将军山网站建设天津公司网站怎样制作
  • wordpress网站如何提速网站建设的定位是什么意思
  • 阳江网站建设公司php做网站需要的软件
  • 网站规划与开发技术专业在线生成小程序
  • 射阳做网站公司君隆做网站怎么样
  • 怎么做领券网站百度seo关键词
  • 网站建设 wordpress专业建设信息化网站资源
  • 深圳小蚁人网站建设推广普通话的绘画作品有哪些
  • 给一个免费的网站制作一个营销型网站
  • 扁平式网站seo 内链wordpress门户网站模板
  • 网站模版建设教程在线做效果图的网站
  • 广告网站模板下载 迅雷下载安装校园门户网站系统建设关键技术
  • 梅州站改造高铁站重庆seo1
  • 网站各类模块内容说明建设工程资质证书二维码扫描网站
  • 专门做2手手机的网站如何做网站的逻辑结构图
  • 网站制作的目的餐饮品牌设计全案
  • 域名备案期间怎么做网站数字创意设计包括哪些方面
  • 做网站外包大学生西宁做腋臭哪里北大DE网站
  • 如何做网站服务器映射浏览器老是出现站长工具
  • 长沙网页设计公司网站网站构建的工作
  • 网站主页的要素如何做局域网网站